blob: 8e8b8180e8feddeb3f5c2d5455ac9b32a06e79f0 [file] [log] [blame]
Alex Savatieievd48994d2018-12-13 12:13:00 +01001from exceptions import Exception
2
3
Alex Savatieiev5118de02019-02-20 15:50:42 -06004class CheckerBaseExceptions(Exception):
Alex Savatieievd48994d2018-12-13 12:13:00 +01005 pass
6
7
Alex Savatieiev5118de02019-02-20 15:50:42 -06008class CheckerException(CheckerBaseExceptions):
Alex Savatieievd48994d2018-12-13 12:13:00 +01009 def __init__(self, message, *args, **kwargs):
10 super(CheckerException, self).__init__(message, *args, **kwargs)
11 # get the trace
12 # TODO: get and log traceback
13
14 # prettify message
Alex Savatieievf808cd22019-03-01 13:17:59 -060015 self.message = "# CheckerException: {}".format(message)
Alex Savatieievd48994d2018-12-13 12:13:00 +010016
17
18class ConfigException(CheckerException):
19 def __init__(self, message, *args, **kwargs):
20 super(ConfigException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060021 self.message = "# Configuration error: {}".format(message)
Alex Savatieiev63576832019-02-27 15:46:26 -060022
23
24class SaltException(CheckerException):
25 def __init__(self, message, *args, **kwargs):
26 super(SaltException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060027 self.message = "# Salt error: {}".format(message)
Alex Savatieiev63576832019-02-27 15:46:26 -060028
29
30class InvalidReturnException(CheckerException):
31 def __init__(self, message, *args, **kwargs):
32 super(InvalidReturnException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060033 self.message = "# Unexpected return value: {}".format(message)