-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathexceptions.py
More file actions
51 lines (37 loc) · 1.93 KB
/
exceptions.py
File metadata and controls
51 lines (37 loc) · 1.93 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
# Define meta class
__metaclass__ = type
class ApplicationError(Exception):
"""Base class for other exceptions"""
def __init__(self, default_message, additional_message=''):
self.default_message = default_message
self.additional_message = additional_message
def __str__(self):
return self.get_message()
def get_message(self):
return self.default_message if self.additional_message == '' else "{}: {}".format(self.default_message,
self.additional_message)
class InvalidModelConfiguration(ApplicationError):
"""Raised when the model's configuration is corrupted"""
def __init__(self, additional_message=''):
# super('Invalid model configuration', additional_message)
super().__init__('Invalid model configuration', additional_message)
class ModelNotFound(ApplicationError):
"""Raised when the model is not found"""
def __init__(self, additional_message=''):
# super('Model not found', additional_message)
super().__init__('Model not found', additional_message)
class ModelNotLoaded(ApplicationError):
"""Raised when the model is not loaded"""
def __init__(self, additional_message=''):
# super('Error loading model', additional_message)
super().__init__('Error loading model', additional_message)
class InvalidInputData(ApplicationError):
"""Raised when the input data is corrupted"""
def __init__(self, additional_message=''):
# super('Invalid input data', additional_message)
super().__init__('Invalid input data', additional_message)
class InferenceEngineNotFound(ApplicationError):
"""Raised when the Inference Engine is not found"""
def __init__(self, additional_message=''):
# super('Inference engine not found', additional_message)
super().__init__('Inference engine not found', additional_message)