forked from dylian94/domoticz-GoodWeSEMS
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexceptions.py
41 lines (33 loc) · 1.43 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
"""Goodwe SEMS exceptions."""
class GoodweException(Exception):
"""Base class for exceptions."""
def __init__(self, message="Error message not defined"):
self.message = message
super().__init__(self.message)
def __str(self):
return str(self.message)
class TooManyRetries(GoodweException):
"""Too many retries to call API"""
def __init__(self):
self.message = "Failed to call GoodWe API (too many retries)"
super().__init__(self.message)
class FailureWithMessage(GoodweException):
"""Too many retries to call API"""
def __init__(self, code):
self.message = "Failed to call GoodWe API (return message = {})".format(code)
super().__init__(self.message)
class FailureWithoutMessage(GoodweException):
"""Too many retries to call API"""
def __init__(self):
self.message = "Failed to call GoodWe API (no return message )"
super().__init__(self.message)
class FailureWithErrorCode(GoodweException):
"""Too many retries to call API"""
def __init__(self, code):
self.message = "Failed to call GoodWe API (return code = {})".format(code)
super().__init__(self.message)
class FailureWithoutErrorCode(GoodweException):
"""Too many retries to call API"""
def __init__(self):
self.message = "Failed to call GoodWe API (no return code )"
super().__init__(self.message)