1 3
class UnexpectedPyrplError(Exception):
2
    """Raise when an unexpected error occurs that should be reported"""
3
    # color codes
4 3
    STARTC = "\x1b[35m"  # purple
5 3
    ENDC = "\x1b[0m"  # normal
6 3
    pyrpl_error_message = STARTC + """\n\n
7
        An unexpected error occured in PyRPL. Please help us to improve the
8
        program by copy-pasting the full error message and optionally some
9
        additional information regarding your setup on
10
        https://www.github.com/lneuhaus/pyrpl/issues as a new issue. It is
11
        possible that we can help you to get rid of the error. If your error
12
        is related to improper usage of the PyRPL API, your report will
13
        help us improve the documentation. Thanks! """ + ENDC
14 3
    def __init__(self, message="", *args):
15 0
        self.message = message + self.pyrpl_error_message
16 0
        super(UnexpectedPyrplError, self).__init__(self.message, *args)
17

18

19 3
class ExpectedPyrplError(Exception):
20
    """Raise when an unexpected error occurs that should be reported"""
21
    # color codes
22 3
    STARTC = "\x1b[35m"  # purple
23 3
    ENDC = "\x1b[0m"  # normal
24 3
    pyrpl_error_message = STARTC + """\n\n
25
        An expected error occured in PyRPL. Please follow the instructions
26
        in this error message and retry! """ + ENDC
27 3
    def __init__(self, message="", *args):
28 3
        self.message = message + self.pyrpl_error_message
29 3
        super(ExpectedPyrplError, self).__init__(self.message, *args)
30

31 3
class NotReadyError(ValueError):
32 3
    pass

Read our documentation on viewing source code .

Loading