Total Complexity | 2 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from typing import Optional |
||
|
|||
2 | |||
3 | |||
4 | class PincerError(Exception): |
||
5 | """ |
||
6 | Base exception class for all Pincer errors. |
||
7 | """ |
||
8 | pass |
||
9 | |||
10 | |||
11 | class UnhandledException(PincerError): |
||
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): |
||
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 |