summaryrefslogtreecommitdiff
path: root/wrappers/python/eduvpn_common/error.py
blob: 626d9a2eb36e78337261b2dac1cdf4221e62b0b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from enum import Enum


class ErrorLevel(Enum):
    """The error level enum"""
    ERR_OTHER = 0
    ERR_INFO = 1
    ERR_WARNING = 2
    ERR_FATAL = 3


class WrappedError(Exception):
    """An exception returned by the Go library

    :param: traceback: str: The traceback of the error including newlines
    :param: cause: str: The cause of the error as a message
    :param: level: ErrorLevel: The level of the error
    """
    def __init__(self, traceback: str, cause: str, level: ErrorLevel):
        super(WrappedError, self).__init__(cause)
        self.traceback = traceback
        self.cause = cause
        self.level = level