mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
b7747cf1df
Flask → Sanic, Requests → HTTP3, Add SSHTunnel for SSH Proxying, Remove Gunicorn dependency
60 lines
1.2 KiB
Python
60 lines
1.2 KiB
Python
"""
|
|
Custom exceptions for hyperglass
|
|
"""
|
|
|
|
|
|
class HyperglassError(Exception):
|
|
"""
|
|
hyperglass base exception.
|
|
"""
|
|
|
|
|
|
class ConfigError(HyperglassError):
|
|
"""
|
|
Raised for user-inflicted configuration issues. Examples:
|
|
- Fat fingered NOS in device definition
|
|
- Used invalid type (str, int, etc.) in hyperglass.yaml
|
|
"""
|
|
|
|
def __init__(self, message):
|
|
super().__init__(message)
|
|
self.message = message
|
|
|
|
def __str__(self):
|
|
return self.message
|
|
|
|
|
|
class CantConnect(HyperglassError):
|
|
def __init__(self, message):
|
|
super().__init__(message)
|
|
self.message = message
|
|
|
|
def __str__(self):
|
|
return self.message
|
|
|
|
|
|
class ParseError(HyperglassError):
|
|
"""
|
|
Raised when an ouput parser encounters an error.
|
|
"""
|
|
|
|
def __init__(self, message):
|
|
super().__init__(message)
|
|
self.message = message
|
|
|
|
def __str__(self):
|
|
return self.message
|
|
|
|
|
|
class UnsupportedDevice(HyperglassError):
|
|
"""
|
|
Raised when an input NOS is not in the supported NOS list.
|
|
"""
|
|
|
|
def __init__(self, message):
|
|
super().__init__(message)
|
|
self.message = message
|
|
|
|
def __str__(self):
|
|
return self.message
|