-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy patherrors.py
More file actions
57 lines (38 loc) · 1.46 KB
/
errors.py
File metadata and controls
57 lines (38 loc) · 1.46 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""Typed errors thrown by this library."""
from __future__ import annotations
class MinFraudError(RuntimeError):
"""There was a non-specific error in minFraud.
This class represents a generic error. It extends :py:exc:`RuntimeError`
and does not add any additional attributes.
"""
class AuthenticationError(MinFraudError):
"""There was a problem authenticating the request."""
class HTTPError(MinFraudError):
"""There was an error when making your HTTP request.
This class represents an HTTP transport error. It extends
:py:exc:`MinFraudError` and adds attributes of its own.
"""
http_status: int | None
"""The HTTP status code returned"""
uri: str | None
"""The URI queried"""
decoded_content: str | None
"""The decoded response content"""
def __init__(
self,
message: str,
http_status: int | None = None,
uri: str | None = None,
decoded_content: str | None = None,
) -> None:
"""Initialize an HTTPError instance."""
super().__init__(message)
self.http_status = http_status
self.uri = uri
self.decoded_content = decoded_content
class InvalidRequestError(MinFraudError):
"""The request was invalid."""
class InsufficientFundsError(MinFraudError):
"""Your account is out of funds for the service queried."""
class PermissionRequiredError(MinFraudError):
"""Your account does not have permission to access this service."""