summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/exceptions.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-02-19 00:19:16 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-02-19 00:19:16 +0000
commitf1a68f37fa9aea41d21049307fef840f9b6a0116 (patch)
treed762e8e262f0ed6d31c689912fdb82dc55771ad1 /lib/sqlalchemy/exceptions.py
parent2d5e6eb93b08961d557399899a51dac225832716 (diff)
downloadsqlalchemy-f1a68f37fa9aea41d21049307fef840f9b6a0116.tar.gz
exception package added, support throughout
Diffstat (limited to 'lib/sqlalchemy/exceptions.py')
-rw-r--r--lib/sqlalchemy/exceptions.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/sqlalchemy/exceptions.py b/lib/sqlalchemy/exceptions.py
new file mode 100644
index 000000000..6883293ec
--- /dev/null
+++ b/lib/sqlalchemy/exceptions.py
@@ -0,0 +1,41 @@
+# exceptions.py - exceptions for SQLAlchemy
+# Copyright (C) 2005,2006 Michael Bayer mike_mp@zzzcomputing.com
+#
+# This module is part of SQLAlchemy and is released under
+# the MIT License: http://www.opensource.org/licenses/mit-license.php
+
+
+class SQLAlchemyError(Exception):
+ """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"""
+ 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
+
+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."""
+ pass
+
+class CommitError(SQLAlchemyError):
+ """raised when an invalid condition is detected upon a commit()"""
+ 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."""
+ pass
+
+class AssertionError(SQLAlchemyError):
+ """corresponds to internal state being detected in an invalid state"""
+ pass
+
+class DBAPIError(SQLAlchemyError):
+ """something weird happened with a particular DBAPI version"""
+ pass \ No newline at end of file