NoReferenceError.__init__(self, message)
self.table_name = tname
+ def __reduce__(self):
+ return self.__class__, (self.args[0], self.table_name)
+
class NoReferencedColumnError(NoReferenceError):
"""Raised by ``ForeignKey`` when the referred ``Column`` cannot be located."""
self.table_name = tname
self.column_name = cname
+ def __reduce__(self):
+ return self.__class__, (self.args[0], self.table_name,
+ self.column_name)
+
class NoSuchTableError(InvalidRequestError):
"""Table does not exist or is not visible to a connection."""
tsa.exc.InterfaceError("select * from table",
{"foo":"bar"},
orig),
+ tsa.exc.NoReferencedTableError("message", "tname"),
+ tsa.exc.NoReferencedColumnError("message", "tname", "cname")
):
for loads, dumps in picklers():
repickled = loads(dumps(sa_exc))
eq_(repickled.args[0], sa_exc.args[0])
- eq_(repickled.params, {"foo":"bar"})
- eq_(repickled.statement, sa_exc.statement)
- if hasattr(sa_exc, "connection_invalidated"):
- eq_(repickled.connection_invalidated,
- sa_exc.connection_invalidated)
- eq_(repickled.orig.args[0], orig.args[0])
+ if isinstance(sa_exc, tsa.exc.StatementError):
+ eq_(repickled.params, {"foo":"bar"})
+ eq_(repickled.statement, sa_exc.statement)
+ if hasattr(sa_exc, "connection_invalidated"):
+ eq_(repickled.connection_invalidated,
+ sa_exc.connection_invalidated)
+ eq_(repickled.orig.args[0], orig.args[0])
def test_dont_wrap_mixin(self):
class MyException(Exception, tsa.exc.DontWrapMixin):