OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
omnisci.exceptions Namespace Reference

Classes

class  Warning
 
class  Error
 
class  InterfaceError
 
class  DatabaseError
 
class  DataError
 
class  OperationalError
 
class  IntegrityError
 
class  InternalError
 
class  ProgrammingError
 
class  NotSupportedError
 

Functions

def _translate_exception
 

Detailed Description

Define exceptions as specified by the DB API 2.0 spec.

Includes some helper methods for translating thrift
exceptions to the ones defined here.

Function Documentation

def omnisci.exceptions._translate_exception (   e)
private
Translate a thrift-land exception to a DB-API 2.0
exception.

Definition at line 54 of file exceptions.py.

Referenced by omnisci.cursor.Cursor.execute().

54 
56  # type: (Exception) -> Exception
57  """Translate a thrift-land exception to a DB-API 2.0
58  exception.
59  """
60  # TODO: see if there's a way to get error codes, rather than relying msgs
61  if not isinstance(e, TOmniSciException):
62  return e
63  if 'Validate failed' in e.error_msg or 'Parse failed' in e.error_msg:
64  err = ProgrammingError
65  elif 'Exception occurred' in e.error_msg:
66  err = DatabaseError
67  else:
68  err = Error
69  return err(e.error_msg)

+ Here is the caller graph for this function: