Alex Savatieiev | d48994d | 2018-12-13 12:13:00 +0100 | [diff] [blame] | 1 | |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 2 | class CheckerBaseExceptions(Exception): |
Alex Savatieiev | d48994d | 2018-12-13 12:13:00 +0100 | [diff] [blame] | 3 | pass |
| 4 | |
| 5 | |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 6 | class CheckerException(CheckerBaseExceptions): |
Alex Savatieiev | d48994d | 2018-12-13 12:13:00 +0100 | [diff] [blame] | 7 | def __init__(self, message, *args, **kwargs): |
| 8 | super(CheckerException, self).__init__(message, *args, **kwargs) |
| 9 | # get the trace |
| 10 | # TODO: get and log traceback |
| 11 | |
| 12 | # prettify message |
Alex Savatieiev | f808cd2 | 2019-03-01 13:17:59 -0600 | [diff] [blame] | 13 | self.message = "# CheckerException: {}".format(message) |
Alex Savatieiev | d48994d | 2018-12-13 12:13:00 +0100 | [diff] [blame] | 14 | |
| 15 | |
| 16 | class ConfigException(CheckerException): |
| 17 | def __init__(self, message, *args, **kwargs): |
| 18 | super(ConfigException, self).__init__(message, *args, **kwargs) |
Alex Savatieiev | f808cd2 | 2019-03-01 13:17:59 -0600 | [diff] [blame] | 19 | self.message = "# Configuration error: {}".format(message) |
Alex Savatieiev | 6357683 | 2019-02-27 15:46:26 -0600 | [diff] [blame] | 20 | |
| 21 | |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 22 | class CommandNotSupportedException(CheckerException): |
| 23 | def __init__(self, message, *args, **kwargs): |
| 24 | super(CommandNotSupportedException, self).__init__( |
| 25 | message, |
| 26 | *args, |
| 27 | **kwargs |
| 28 | ) |
| 29 | self.message = "# Command not supported: {}".format(message) |
| 30 | |
| 31 | |
| 32 | class CommandTypeNotSupportedException(CheckerException): |
| 33 | def __init__(self, message, *args, **kwargs): |
| 34 | super(CommandTypeNotSupportedException, self).__init__( |
| 35 | message, |
| 36 | *args, |
| 37 | **kwargs |
| 38 | ) |
| 39 | self.message = "# Command type not supported: {}".format(message) |
| 40 | |
| 41 | |
Alex Savatieiev | 6357683 | 2019-02-27 15:46:26 -0600 | [diff] [blame] | 42 | class SaltException(CheckerException): |
| 43 | def __init__(self, message, *args, **kwargs): |
| 44 | super(SaltException, self).__init__(message, *args, **kwargs) |
Alex Savatieiev | f808cd2 | 2019-03-01 13:17:59 -0600 | [diff] [blame] | 45 | self.message = "# Salt error: {}".format(message) |
Alex Savatieiev | 6357683 | 2019-02-27 15:46:26 -0600 | [diff] [blame] | 46 | |
| 47 | |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 48 | class KubeException(CheckerException): |
| 49 | def __init__(self, message, *args, **kwargs): |
| 50 | super(KubeException, self).__init__(message, *args, **kwargs) |
| 51 | self.message = "# Kube client error: {}".format(message) |
| 52 | |
| 53 | |
Alex Savatieiev | 6357683 | 2019-02-27 15:46:26 -0600 | [diff] [blame] | 54 | class InvalidReturnException(CheckerException): |
| 55 | def __init__(self, message, *args, **kwargs): |
| 56 | super(InvalidReturnException, self).__init__(message, *args, **kwargs) |
Alex Savatieiev | f808cd2 | 2019-03-01 13:17:59 -0600 | [diff] [blame] | 57 | self.message = "# Unexpected return value: {}".format(message) |
Alex | 3ebc563 | 2019-04-18 16:47:18 -0500 | [diff] [blame] | 58 | |
| 59 | |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 60 | class TimeoutException(CheckerException): |
| 61 | def __init__(self, message, *args, **kwargs): |
| 62 | super(TimeoutException, self).__init__(message, *args, **kwargs) |
| 63 | self.message = "# Timed out waiting: {}".format(message) |
| 64 | |
| 65 | |
Alex | 3ebc563 | 2019-04-18 16:47:18 -0500 | [diff] [blame] | 66 | class ErrorMappingException(CheckerException): |
| 67 | def __init__(self, message, *args, **kwargs): |
| 68 | super(ErrorMappingException, self).__init__(message, *args, **kwargs) |
| 69 | self.message = "# Unexpected error mapping/type: {}".format(message) |