From 57f9701ab23050cddedbe058b4390d0630d1fd4f Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 16 Sep 2014 16:48:40 -0400 Subject: [PATCH] Clean up exception definitions --- .../xmodule/xmodule/modulestore/draft_and_published.py | 2 +- common/lib/xmodule/xmodule/modulestore/exceptions.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/draft_and_published.py b/common/lib/xmodule/xmodule/modulestore/draft_and_published.py index 1f8f521758..27895ce06d 100644 --- a/common/lib/xmodule/xmodule/modulestore/draft_and_published.py +++ b/common/lib/xmodule/xmodule/modulestore/draft_and_published.py @@ -113,7 +113,7 @@ class ModuleStoreDraftAndPublished(BranchSettingMixin): raise NotImplementedError -class UnsupportedRevisionError(ValueError): +class UnsupportedRevisionError(ValueError): """ This error is raised if a method is called with an unsupported revision parameter. """ diff --git a/common/lib/xmodule/xmodule/modulestore/exceptions.py b/common/lib/xmodule/xmodule/modulestore/exceptions.py index e6fa9edc0f..d98c744009 100644 --- a/common/lib/xmodule/xmodule/modulestore/exceptions.py +++ b/common/lib/xmodule/xmodule/modulestore/exceptions.py @@ -74,7 +74,9 @@ class DuplicateCourseError(Exception): """ existing_entry will have the who, when, and other properties of the existing entry """ - super(DuplicateCourseError, self).__init__() + super(DuplicateCourseError, self).__init__( + u'Cannot create course {}, which duplicates {}'.format(course_id, existing_entry) + ) self.course_id = course_id self.existing_entry = existing_entry @@ -84,9 +86,6 @@ class InvalidBranchSetting(Exception): Raised when the process' branch setting did not match the required setting for the attempted operation on a store. """ def __init__(self, expected_setting, actual_setting): - super(InvalidBranchSetting, self).__init__() + super(InvalidBranchSetting, self).__init__(u"Invalid branch: expected {} but got {}".format(expected_setting, actual_setting)) self.expected_setting = expected_setting self.actual_setting = actual_setting - - def __unicode__(self, *args, **kwargs): - return u"Invalid branch: expected {} but got {}".format(self.expected_setting, self.actual_setting)