OmniSciDB
a5dc49c757
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
exceptions.py
Go to the documentation of this file.
1
"""
2
Define exceptions as specified by the DB API 2.0 spec.
3
4
Includes some helper methods for translating thrift
5
exceptions to the ones defined here.
6
"""
7
from
heavydb.thrift.ttypes
import
TDBException
8
9
10
class
Warning
(Exception):
11
"""Emitted for important warnings, e.g. data truncatiions"""
12
13
14
class
Error
(Exception):
15
"""Base class for all pymapd errors."""
16
17
18
class
InterfaceError
(
Error
):
19
"""Raised whenever you use pymapd interface incorrectly."""
20
21
22
class
DatabaseError
(
Error
):
23
"""Raised when the database encounters an error."""
24
25
26
class
DataError
(
DatabaseError
):
27
"""Raised for data processing errors like division by zero, etc."""
28
29
30
class
OperationalError
(
DatabaseError
):
31
"""Raised for non-programmer related database errors, e.g.
32
an unexpected disconnect.
33
"""
34
35
36
class
IntegrityError
(
DatabaseError
):
37
"""Raised when the relational integrity of the database is affected."""
38
39
40
class
InternalError
(
DatabaseError
):
41
"""Raised for errors internal to the database, e.g. and invalid cursor."""
42
43
44
class
ProgrammingError
(
DatabaseError
):
45
"""Raised for programming errors, e.g. syntax errors, table already
46
exists.
47
"""
48
49
50
class
NotSupportedError
(
DatabaseError
):
51
"""Raised when an API not supported by the database is used."""
52
53
54
def
_translate_exception
(e):
55
# type: (Exception) -> Exception
56
"""Translate a thrift-land exception to a DB-API 2.0
57
exception.
58
"""
59
# TODO: see if there's a way to get error codes, rather than relying msgs
60
if
not
isinstance(e, TDBException):
61
return
e
62
if
'SQL Error'
in
e.error_msg:
63
err = ProgrammingError
64
else
:
65
err = Error
66
return
err(e.error_msg)
heavydb.exceptions.DataError
Definition:
exceptions.py:26
heavydb.exceptions.DatabaseError
Definition:
exceptions.py:22
heavydb.exceptions.OperationalError
Definition:
exceptions.py:30
heavydb.thrift.ttypes
Definition:
ttypes.py:1
heavydb.exceptions._translate_exception
def _translate_exception
Definition:
exceptions.py:54
heavydb.exceptions.ProgrammingError
Definition:
exceptions.py:44
heavydb.exceptions.InterfaceError
Definition:
exceptions.py:18
heavydb.exceptions.Error
Definition:
exceptions.py:14
heavydb.exceptions.Warning
Definition:
exceptions.py:10
heavydb.exceptions.NotSupportedError
Definition:
exceptions.py:50
heavydb.exceptions.IntegrityError
Definition:
exceptions.py:36
heavydb.exceptions.InternalError
Definition:
exceptions.py:40
python
heavydb
exceptions.py
Generated on Tue Aug 27 2024 00:12:40 for OmniSciDB by
1.8.5