Alex Savatieiev | d48994d | 2018-12-13 12:13:00 +0100 | [diff] [blame] | 1 | from exceptions import Exception |
| 2 | |
| 3 | |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 4 | class CheckerBaseExceptions(Exception): |
Alex Savatieiev | d48994d | 2018-12-13 12:13:00 +0100 | [diff] [blame] | 5 | pass |
| 6 | |
| 7 | |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 8 | class CheckerException(CheckerBaseExceptions): |
Alex Savatieiev | d48994d | 2018-12-13 12:13:00 +0100 | [diff] [blame] | 9 | 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 |
| 15 | self.message = "CheckerException: {}".format(message) |
| 16 | |
| 17 | |
| 18 | class ConfigException(CheckerException): |
| 19 | def __init__(self, message, *args, **kwargs): |
| 20 | super(ConfigException, self).__init__(message, *args, **kwargs) |
| 21 | self.message = "Configuration error: {}".format(message) |
Alex Savatieiev | 6357683 | 2019-02-27 15:46:26 -0600 | [diff] [blame^] | 22 | |
| 23 | |
| 24 | class SaltException(CheckerException): |
| 25 | def __init__(self, message, *args, **kwargs): |
| 26 | super(SaltException, self).__init__(message, *args, **kwargs) |
| 27 | self.message = "Salt error: {}".format(message) |
| 28 | |
| 29 | |
| 30 | class InvalidReturnException(CheckerException): |
| 31 | def __init__(self, message, *args, **kwargs): |
| 32 | super(InvalidReturnException, self).__init__(message, *args, **kwargs) |
| 33 | self.message = "Unexpected return value: {}".format(message) |