-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_exeptions.py
48 lines (41 loc) · 1.6 KB
/
custom_exeptions.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
# Exption subclssese for data_processing
class CSVReadErr(Exception):
def __init__(self, message='Error reading CSV file'):
"""
Error raised for issues reading a CSV file.
Parameters
----------
message : str, optional
Custom error message. Default is 'Error reading CSV file'.
"""
self.message = message
super().__init__(self.message)
class LenMismatchErr(Exception):
def __init__(self, train_dim, ideal_dim, message='Mismatch in length between ideal and training data:'):
"""
Error raised for length mismatches between ideal and training data.
Parameters
----------
train_dim : int
Number of points in the training data.
ideal_dim : int
Number of points in the ideal data.
message : str, optional
Custom error message prefix. Default is 'Mismatch in length between ideal and training data:'.
"""
self.message = '\n'.join([
message,
f'Amount of train points {train_dim}',
f'Amount of ideal points {ideal_dim}'])
super().__init__(self.message)
class MissPointsErr(Exception):
def __init__(self, message='Some points missing, features (x) are not equal'):
"""
Error raised when some points are missing, leading to unequal features.
Parameters
----------
message : str, optional
Custom error message. Default is 'Some points missing, features (x) are not equal'.
"""
self.message = message
super().__init__(self.message)