diff options
Diffstat (limited to 'lib/sqlalchemy/exc.py')
-rw-r--r-- | lib/sqlalchemy/exc.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index a24cf7ba4..bcec7d30d 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -43,6 +43,12 @@ class HasDescriptionCode(object): ) ) + def __str__(self): + message = super(HasDescriptionCode, self).__str__() + if self.code: + message = "%s %s" % (message, self._code_str()) + return message + class SQLAlchemyError(HasDescriptionCode, Exception): """Generic error class.""" @@ -660,12 +666,6 @@ class SADeprecationWarning(HasDescriptionCode, DeprecationWarning): deprecated_since = None "Indicates the version that started raising this deprecation warning" - def __str__(self): - message = super(SADeprecationWarning, self).__str__() - if self.code: - message = "%s %s" % (message, self._code_str()) - return message - class RemovedIn20Warning(SADeprecationWarning): """Issued for usage of APIs specifically deprecated in SQLAlchemy 2.0. |