forked from ContinuumIO/PostgresAdapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.py
More file actions
executable file
·64 lines (51 loc) · 2.04 KB
/
Copy patherrors.py
File metadata and controls
executable file
·64 lines (51 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class AdapterException(Exception):
"""Generic adapter exception for reporting reading, parsing, and
converting issues. All adapter exceptions have following instance
variables in common:
* `record` - record reference where error occured
* `field` - field reference where error occured
"""
def __init__(self, message=None):
super(AdapterException, self).__init__(message)
self.record = None
self.field = None
class SourceError(AdapterException):
"""Raised on error while reading or talking to a data source. It might be
seek or read error for file sources or broken connection for database
sources."""
pass
class SourceNotFoundError(SourceError):
"""Raised when data source (file, table, ...) was not found."""
def __init__(self, message=None, source=None):
super(SourceNotFoundError, self).__init__(message)
self.source = source
class ConfigurationError(AdapterException):
"""Raised when objects are mis-configured."""
pass
class NoSuchFieldError(AdapterException):
"""Raised when non-existent field is referenced, either by name or position index."""
pass
class DataIndexError(AdapterException):
"""Raised for example when a record is not found in record index in indexed
data source."""
pass
class DataTypeError(AdapterException):
"""Raised on data type mis-match or when type conversion fails."""
pass
class ParserError(AdapterException):
"""Raised when there is problem with parsing source data, for example in
broken text file with CSV. The `token` instance variable contains problematic
token that was not parsed correctly."""
def __init__(self, message=None, token=None):
super(ParserError, self).__init__(message)
self.token = token
class ArgumentError(AdapterException):
"""Invalid arguments used in calling postgresadapter functions/methods"""
pass
class InternalInconsistencyError(AdapterException):
"""Raised when the library goes into a state that is not expected to
happen."""
pass
class AdapterIndexError(AdapterException):
""" Raised when record number or slice is invalid """
pass