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
46 changes: 41 additions & 5 deletions kytos/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,52 @@ 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"""
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(KytosTagError):
"""Exception thrown when a tag is outside of tag ranges"""
def __init__(self, conflict: list[list[int]], intf_id: str) -> None:
msg = f"The tags {conflict} are outside tag_ranges in {intf_id}"
super().__init__(f"KytosSetTagRangeError, {msg}")


class KytosTagtypeNotSupported(Exception):
"""Exception thronw when a not supported tag type is not supported"""
class KytosTagsAreNotAvailable(KytosTagError):
"""Exception thrown when a tag is not available."""
def __init__(self, conflict: list[list[int]], intf_id: str) -> None:
msg = f"The tags {conflict} are not available in {intf_id}"
super().__init__(f"KytosSetTagRangeError, {msg}")


# Exceptions related to NApps
Expand Down
Loading
Loading