-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
77 lines (60 loc) · 3.05 KB
/
Copy pathexceptions.py
File metadata and controls
77 lines (60 loc) · 3.05 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
class InvalidArgsCombo(Exception):
def __init__(
self,
message=(
"The provided combination of arguments is invalid. "
"Please see README.md for more information."
)
):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"InvalidArgsCombo: {self.message}"
class NoConnectionError(Exception):
def __init__(self, message="No connection could be established."):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"NoConnectionError: {self.message}"
class ConnectionTerminatedByClientException(Exception):
def __init__(self, message="The connection is terminated by the client. This error is common when the client terminated the transfer process, or when an unexpected error occured in the client script. Please check the client script and fix the error from there."):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"ConnectionTerminatedByClientException: {self.message}"
class InvalidKeyOnClientError(Exception):
def __init__(self, message="The encryption key does not match between the server and client. Please make sure the client is started with the '-e' or '--encrypt' option and the correct password."):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"InvalidKeyOnClientError: {self.message}"
class CorruptedPacket(Exception):
def __init__(self, message="A corrupted packet was received. Try increasing the 'throttling_delay' variable in config.py on the server side."):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"CorruptedPacket: {self.message}"
class StrictModeImbalanceException(Exception):
def __init__(self, message="You must either use strict mode on both system or not use strict mode at all."):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"StrictModeImbalanceException: {self.message}"
class LowMemModeImbalanceException(Exception):
def __init__(self, message="Low-memory mode must be enabled or disabled consistently on both server and client."):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"LowMemModeImbalanceException: {self.message}"
class PacketChunkSizeNotMatch(Exception):
def __init__(self, message = "The packet chunk size does not match between server and client. Please ensure that you have same packet chunk size for your mode in both your server and client"):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"PacketChunkSizeNotMatch {self.message}"
class EncryptionError(Exception):
def __init__(self, message = "Unexpected Error in encryption system"):
self.message = message
super().__init__(self.message)
def __str__(self):
return f"Encryption Error: {self.message}"