Passed
Push — main ( a47b7f...8b0789 )
by Yohann
01:13
created

pincer.exceptions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A UnhandledException.__init__() 0 8 1
A InvalidTokenError.__init__() 0 9 1
1
from typing import Optional
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
3
4
class PincerError(Exception):
5
    """
6
    Base exception class for all Pincer errors.
7
    """
8
    pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
9
10
11
class UnhandledException(PincerError):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
12
    def __init__(self, specific: str):
13
        """
14
        Exception which gets thrown if an exception wasn't handled.
15
16
        If this exception gets thrown please create an issue on our github.
17
        """
18
        super(UnhandledException, self).__init__(
19
            specific + " Please report this to the library devs."
20
        )
21
22
23
class InvalidTokenError(PincerError, ValueError):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
24
    def __init__(self, hint: Optional[str] = None):
25
        """
26
        Exception raised when the authorization token is invalid.
27
28
        :param hint:
29
            Additional information about the exception cause.
30
        """
31
        super(InvalidTokenError, self).__init__(
32
            "The given token is not a valid token." + (str(hint) * bool(hint))
33
        )
34