diff options
Diffstat (limited to 'oslo_db/exception.py')
-rw-r--r-- | oslo_db/exception.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/oslo_db/exception.py b/oslo_db/exception.py index 715bbc1..c5e0fa9 100644 --- a/oslo_db/exception.py +++ b/oslo_db/exception.py @@ -43,6 +43,7 @@ with `try/except` statement. This is required for consistent handling of database errors. """ +import debtcollector.removals import six from oslo_db._i18n import _ @@ -147,6 +148,13 @@ class DBInvalidUnicodeParameter(Exception): without encoding directive. """ + @debtcollector.removals.removed_property + def message(self): + # NOTE(rpodolyaka): provided for compatibility with python 3k, where + # exceptions do not have .message attribute, while we used to have one + # in this particular exception class. See LP #1542961 for details. + return str(self) + def __init__(self): super(DBInvalidUnicodeParameter, self).__init__( _("Invalid Parameter: Encoding directive wasn't provided.")) @@ -184,6 +192,13 @@ class DBDataError(DBError): class InvalidSortKey(Exception): """A sort key destined for database query usage is invalid.""" + @debtcollector.removals.removed_property + def message(self): + # NOTE(rpodolyaka): provided for compatibility with python 3k, where + # exceptions do not have .message attribute, while we used to have one + # in this particular exception class. See LP #1542961 for details. + return str(self) + def __init__(self, key=None): super(InvalidSortKey, self).__init__( _("Sort key supplied is invalid: %s") % key) |