-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexceptions.py
More file actions
107 lines (63 loc) · 2.36 KB
/
exceptions.py
File metadata and controls
107 lines (63 loc) · 2.36 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from print_service.settings import get_settings
settings = get_settings()
class ObjectNotFound(Exception):
pass
class TerminalTokenNotFound(ObjectNotFound):
pass
class TerminalQRNotFound(ObjectNotFound):
pass
class PINNotFound(ObjectNotFound):
def __init__(self, pin: str):
self.pin = pin
class UserNotFound(ObjectNotFound):
pass
class FileNotFound(ObjectNotFound):
def __init__(self, count: int):
self.count = count
class TooManyPages(Exception):
def __init__(self):
super().__init__(f'Content too large, count of page: {settings.MAX_PAGE_COUNT} is allowed')
class TooLargeSize(Exception):
def __init__(self):
super().__init__(f'Content too large, {settings.MAX_SIZE} bytes allowed')
class InvalidPageRequest(Exception):
def __init__(self):
super().__init__(f'The number of requested pages exceeds the number of pages')
class UnionStudentDuplicate(Exception):
def __init__(self):
super().__init__('Duplicates by union_numbers or student_numbers')
class NotInUnion(Exception):
def __init__(self):
super().__init__(f'User is not found in trade union list')
class PINGenerateError(Exception):
def __init__(self):
super().__init__(f'Can not generate PIN. Too many users?')
class FileIsNotReceived(Exception):
def __init__(self):
super().__init__(f'No file was received')
class InvalidType(Exception):
def __init__(self, content_type: str):
super().__init__(
f'Only {", ".join(settings.CONTENT_TYPES)} files allowed, but {content_type} was received'
)
class AlreadyUploaded(Exception):
def __init__(self):
super().__init__(f'File has been already uploaded')
class IsCorrupted(Exception):
def __init__(self):
super().__init__(f'File is corrupted')
class IsNotUploaded(Exception):
def __init__(self):
super().__init__(f'File has not been uploaded yet')
class UnprocessableFileInstance(Exception):
def __init__(self):
super().__init__(f'Unprocessable file instance')
class TokenAlreadyUsed(Exception):
def __init__(self):
super().__init__(f'Token already used')
class Unauthorized(Exception):
def __init__(self):
super().__init__(f'Unauthorized')
class NotAuthenticated(Exception):
def __init__(self):
super().__init__(f'Not authenticated')