File: exceptions.py

package info (click to toggle)
python-pyodata 1.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,280 kB
  • sloc: python: 7,170; xml: 947; makefile: 67; sh: 15
file content (41 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download
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
"""PyOData exceptions hierarchy"""


class PyODataException(Exception):
    """Base class for all PyOData exceptions

       Raised when an error is detected that does not fall in any of the other categories.
    """


class PyODataModelError(PyODataException):
    """Raised when model error occurs"""


class PyODataParserError(PyODataException):
    """Raised when parser error occurs"""


class ExpressionError(PyODataException):
    """Raise when runtime logical expression error occurs"""


class HttpError(PyODataException):
    """Raised when unexpected HTTP status code is received """

    VendorType = None

    def __new__(cls, message, response):
        if HttpError.VendorType is not None:
            return super(HttpError, cls).__new__(HttpError.VendorType, message, response)

        return super(HttpError, cls).__new__(cls, message, response)

    def __init__(self, message, response):
        super(HttpError, self).__init__(message)

        self.response = response


class ProgramError(PyODataException):
    """Raised when an error in the program logic occurs"""