Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Added support to list[list[int]] input #428

Merged
merged 13 commits into from
Nov 22, 2023
64 changes: 59 additions & 5 deletions kytos/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,70 @@ def __str__(self):
return msg


class KytosSetTagRangeError(Exception):
class KytosLinkCreationError(Exception):
"""Exception thrown when the link has an empty endpoint."""


class KytosTagError(Exception):
"""Exception to catch an error when setting tag type or value."""
def __init__(self, msg: str) -> None:
self.msg = msg

def __str__(self) -> str:
return f"{self.msg}"

def __repr__(self) -> str:
return f"{self.msg}"


class KytosTagtypeNotSupported(KytosTagError):
"""Exception thrown when a not supported tag type is not supported"""
viniarck marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self, msg: str) -> None:
super().__init__(f"KytosTagtypeNotSupported, {msg}")


class KytosInvalidTagRanges(KytosTagError):
"""Exception thrown when a list of ranges is invalid."""
def __init__(self, msg: str) -> None:
super().__init__(f"KytosInvalidTagRanges, {msg}")


class KytosSetTagRangeError(KytosTagError):
"""Exception raised when available_tag cannot be resized"""
def __init__(self, msg: str) -> None:
super().__init__(f"KytosSetTagRangeError, {msg}")


class KytosLinkCreationError(Exception):
"""Exception thrown when the link has an empty endpoint."""
class KytosTagsNotInTagRanges(Exception):
"""Exception thrown when a tag is outside of tag ranges"""
def __init__(self, conflict: list[list[int]], intf_id: str) -> None:
super().__init__()
self.conflict = conflict
self.intf_id = intf_id

def __repr__(self):
return f"The tags {self.conflict} are outside tag_ranges"\
f" in {self.intf_id}"

def __str__(self) -> str:
return f"The tags {self.conflict} are outside tag_ranges"\
f" in {self.intf_id}"


class KytosTagsAreNotAvailable(Exception):
"""Exception thrown when a tag is not available."""
def __init__(self, conflict: list[list[int]], intf_id: str) -> None:
super().__init__()
self.conflict = conflict
self.intf_id = intf_id

def __repr__(self):
return f"The tags {self.conflict} are not available."\
viniarck marked this conversation as resolved.
Show resolved Hide resolved
f" in {self.intf_id}"

class KytosTagtypeNotSupported(Exception):
"""Exception thronw when a not supported tag type is not supported"""
def __str__(self) -> str:
return f"The tags {self.conflict} are not available."\
f" in {self.intf_id}"


# Exceptions related to NApps
Expand Down
Loading
Loading