-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.py
More file actions
22 lines (18 loc) · 823 Bytes
/
Copy patherrors.py
File metadata and controls
22 lines (18 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class InvalidArgumentError(Exception):
'''
This exception will be thrown when the program argument is invalie
'''
def __init__(self, argument_name, argument_value=None):
if argument_value is not None:
msg = "'{}' is not a valid value for argument '{}'".format(
argument_value, argument_name
)
else:
msg = "Argument '{}' should not be empty".format(argument_name)
super().__init__(msg)
class FileNotFoundException(Exception):
def __init__(self, filename):
super().__init__("'{}' does not exist or is inaccessible".format(filename))
class FileWriteError(Exception):
def __init__(self, filename, reason):
super().__init__("Error while writing to {} due to {}".format(filename, reason))