2021-06-09 18:44:10 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
"""Custom exceptions."""
|
|
|
|
|
|
|
|
|
|
|
|
class PrometheusSDError(Exception):
|
2022-03-11 12:37:19 +00:00
|
|
|
"""Generic exception class for Prometheus-pve-sd."""
|
2021-06-09 18:44:10 +00:00
|
|
|
|
|
|
|
def __init__(self, msg, original_exception=""):
|
2023-02-12 14:11:15 +00:00
|
|
|
super().__init__(f"{msg}\n{original_exception}")
|
2021-06-09 18:44:10 +00:00
|
|
|
self.original_exception = original_exception
|
|
|
|
|
|
|
|
|
2021-06-09 20:57:48 +00:00
|
|
|
class APIError(PrometheusSDError):
|
|
|
|
"""Errors related to API connections."""
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2021-06-09 18:44:10 +00:00
|
|
|
class ConfigError(PrometheusSDError):
|
|
|
|
"""Errors related to config file handling."""
|
|
|
|
|
|
|
|
pass
|