1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

model restructure, front-end improvements

This commit is contained in:
checktheroads
2019-10-09 03:10:52 -07:00
parent 7a77ff6e50
commit 962fd21bf9
45 changed files with 1325 additions and 979 deletions

View File

@@ -6,7 +6,7 @@ Custom exceptions for hyperglass
class HyperglassError(Exception):
"""hyperglass base exception"""
def __init__(self, message="", alert="warning", keywords={}):
def __init__(self, message="", alert="warning", keywords=[]):
self.message = message
self.alert = alert
self.keywords = keywords
@@ -105,6 +105,19 @@ class InputNotAllowed(HyperglassError):
super().__init__(message=self.message, alert=self.alert, keywords=self.keywords)
class ResponseEmpty(HyperglassError):
"""
Raised when hyperglass is able to connect to the device and execute
a valid query, but the response is empty.
"""
def __init__(self, unformatted_msg, **kwargs):
self.message = unformatted_msg.format(**kwargs)
self.alert = "warning"
self.keywords = [value for value in kwargs.values()]
super().__init__(message=self.message, alert=self.alert, keywords=self.keywords)
class UnsupportedDevice(HyperglassError):
"""Raised when an input NOS is not in the supported NOS list."""