-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
85 lines (69 loc) · 1.79 KB
/
exceptions.py
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
"""
Provide basic exception handling for common errors that may arise.
@author: Luke Kurlandski
@date: December 2019
@copyright: Copyright 2019, Luke Kurlandski, all rights reserved
Special thanks to Daniel Stolz, Matthew Van Soelen, and Dr. David McGee.
Read the Program Guide for detailed information about this program.
"""
class MyError(Exception):
"""
Exceptions for common errors.
"""
def __init__(self, message:str=None, exception:Exception=None, advice:str=None):
"""
Create exceptions of this class with these three properties.
"""
self.message = message
self.exception = exception
self.advice = advice
class FileFormatError(MyError):
"""
Raise when a storage file is written to in the wrong format.
"""
pass
class InputError(MyError):
"""
Raise when the user has input data incorrectly.
"""
pass
class NoFileError(MyError):
"""
Raise when any type of file cannot be located.
"""
pass
class UnknownError(MyError):
"""
Raise when an unexpected error occurs.
"""
pass
class MissingDataError(MyError):
"""
Raise when nessecary data is not available.
"""
pass
class UserInterruptError(MyError):
"""
Raise when user halts a process.
"""
pass
class EquipmentError(MyError):
"""
Provide framework for any kind of equipment error.
"""
pass
class ShutterError(EquipmentError):
"""
Raise when an error occurs with shutter.
"""
pass
class MotorError(EquipmentError):
"""
Raise when an error occurs with motor.
"""
pass
class LaserError(EquipmentError):
"""
Raise when an error occurs with laser.
"""
pass