Python sqlalchemy.exc.DontWrapMixin() Examples
The following are 8
code examples of sqlalchemy.exc.DontWrapMixin().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sqlalchemy.exc
, or try the search function
.
Example #1
Source File: exc.py From moviegrabber with GNU General Public License v3.0 | 6 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if isinstance(orig, (KeyboardInterrupt, SystemExit, DontWrapMixin)): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if not isinstance(orig, dbapi_base_err) and statement: msg = traceback.format_exception_only( orig.__class__, orig)[-1].strip() return StatementError( "%s (original cause: %s)" % (str(orig), msg), statement, params, orig ) name, glob = orig.__class__.__name__, globals() if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] return cls(statement, params, orig, connection_invalidated)
Example #2
Source File: exc.py From jbox with MIT License | 5 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False, dialect=None): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if (isinstance(orig, BaseException) and not isinstance(orig, Exception)) or \ isinstance(orig, DontWrapMixin): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if not isinstance(orig, dbapi_base_err) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if dialect: name = dialect.dbapi_exception_translation_map.get( name, name) if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated)
Example #3
Source File: exc.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False, dialect=None): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if (isinstance(orig, BaseException) and not isinstance(orig, Exception)) or \ isinstance(orig, DontWrapMixin): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if not isinstance(orig, dbapi_base_err) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if dialect: name = dialect.dbapi_exception_translation_map.get( name, name) if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated)
Example #4
Source File: exc.py From planespotter with MIT License | 5 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False, dialect=None): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if (isinstance(orig, BaseException) and not isinstance(orig, Exception)) or \ isinstance(orig, DontWrapMixin): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if isinstance(orig, SQLAlchemyError) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig.args[0]), statement, params, orig, code=orig.code ) elif not isinstance(orig, dbapi_base_err) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if dialect: name = dialect.dbapi_exception_translation_map.get( name, name) if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated, code=cls.code)
Example #5
Source File: exc.py From pyRevit with GNU General Public License v3.0 | 5 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False, dialect=None): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if (isinstance(orig, BaseException) and not isinstance(orig, Exception)) or \ isinstance(orig, DontWrapMixin): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if not isinstance(orig, dbapi_base_err) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if dialect: name = dialect.dbapi_exception_translation_map.get( name, name) if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated)
Example #6
Source File: exc.py From stdm with GNU General Public License v2.0 | 5 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if isinstance(orig, (KeyboardInterrupt, SystemExit, DontWrapMixin)): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if not isinstance(orig, dbapi_base_err) and statement: msg = traceback.format_exception_only( orig.__class__, orig)[-1].strip() return StatementError( "%s (original cause: %s)" % (str(orig), msg), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated)
Example #7
Source File: exc.py From jarvis with GNU General Public License v2.0 | 5 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False, dialect=None): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if (isinstance(orig, BaseException) and not isinstance(orig, Exception)) or \ isinstance(orig, DontWrapMixin): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if isinstance(orig, SQLAlchemyError) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig.args[0]), statement, params, orig, code=orig.code ) elif not isinstance(orig, dbapi_base_err) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if dialect: name = dialect.dbapi_exception_translation_map.get( name, name) if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated, code=cls.code)
Example #8
Source File: exc.py From android_universal with MIT License | 5 votes |
def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False, dialect=None): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if (isinstance(orig, BaseException) and not isinstance(orig, Exception)) or \ isinstance(orig, DontWrapMixin): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if isinstance(orig, SQLAlchemyError) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig.args[0]), statement, params, orig, code=orig.code ) elif not isinstance(orig, dbapi_base_err) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if dialect: name = dialect.dbapi_exception_translation_map.get( name, name) if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated, code=cls.code)