Added Try-Catch for getTaskType.