diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-02-25 22:44:52 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-02-25 22:44:52 +0000 |
commit | 962c22c9eda7d2ab7dc0b41bd1c7a52cf0c9d008 (patch) | |
tree | f0ab113c7947c80dfea42d4a1bef52217bf6ed96 /lib/sqlalchemy/exceptions.py | |
parent | 8fa3becd5fac57bb898a0090bafaac377b60f070 (diff) | |
download | sqlalchemy-962c22c9eda7d2ab7dc0b41bd1c7a52cf0c9d008.tar.gz |
migrated (most) docstrings to pep-257 format, docstring generator using straight <pre> + trim() func
for now. applies most of [ticket:214], compliemnts of Lele Gaifax
Diffstat (limited to 'lib/sqlalchemy/exceptions.py')
-rw-r--r-- | lib/sqlalchemy/exceptions.py | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/lib/sqlalchemy/exceptions.py b/lib/sqlalchemy/exceptions.py index 7e3883aec..e9d7d0c44 100644 --- a/lib/sqlalchemy/exceptions.py +++ b/lib/sqlalchemy/exceptions.py @@ -6,59 +6,77 @@ class SQLAlchemyError(Exception): - """generic error class""" + """Generic error class.""" + pass - + class SQLError(SQLAlchemyError): - """raised when the execution of a SQL statement fails. includes accessors - for the underlying exception, as well as the SQL and bind parameters""" + """Raised when the execution of a SQL statement fails. + + Includes accessors for the underlying exception, as well as the + SQL and bind parameters. + """ + def __init__(self, statement, params, orig): SQLAlchemyError.__init__(self, "(%s) %s"% (orig.__class__.__name__, str(orig))) self.statement = statement self.params = params self.orig = orig + def __str__(self): return SQLAlchemyError.__str__(self) + " " + repr(self.statement) + " " + repr(self.params) class ArgumentError(SQLAlchemyError): - """raised for all those conditions where invalid arguments are sent to constructed - objects. This error generally corresponds to construction time state errors.""" + """Raised for all those conditions where invalid arguments are + sent to constructed objects. This error generally corresponds to + construction time state errors. + """ + pass class TimeoutError(SQLAlchemyError): - """raised when a connection pool times out on getting a connection""" + """Raised when a connection pool times out on getting a connection.""" + pass class ConcurrentModificationError(SQLAlchemyError): - """raised when a concurrent modification condition is detected""" + """Raised when a concurrent modification condition is detected.""" + pass - + class FlushError(SQLAlchemyError): - """raised when an invalid condition is detected upon a flush()""" + """Raised when an invalid condition is detected upon a ``flush()``.""" pass - + class InvalidRequestError(SQLAlchemyError): - """sqlalchemy was asked to do something it cant do, return nonexistent data, etc. - This error generally corresponds to runtime state errors.""" + """SQLAlchemy was asked to do something it can't do, return + nonexistent data, etc. + + This error generally corresponds to runtime state errors. + """ + pass class NoSuchTableError(InvalidRequestError): - """sqlalchemy was asked to load a table's definition from the database, - but the table doesn't exist.""" + """SQLAlchemy was asked to load a table's definition from the + database, but the table doesn't exist. + """ + pass class AssertionError(SQLAlchemyError): - """corresponds to internal state being detected in an invalid state""" + """Corresponds to internal state being detected in an invalid state.""" + pass class NoSuchColumnError(KeyError, SQLAlchemyError): - """raised by RowProxy when a nonexistent column is requested from a row""" + """Raised by ``RowProxy`` when a nonexistent column is requested from a row.""" + pass - + class DBAPIError(SQLAlchemyError): - """something weird happened with a particular DBAPI version""" + """Something weird happened with a particular DBAPI version.""" + def __init__(self, message, orig): SQLAlchemyError.__init__(self, "(%s) (%s) %s"% (message, orig.__class__.__name__, str(orig))) self.orig = orig - - |