mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 06:04:21 +01:00
Refactors cli to avoid multi-type returns (normal return + None). Adds exceptions for errors.
This commit is contained in:
22
cli/exceptions.py
Normal file
22
cli/exceptions.py
Normal file
@@ -0,0 +1,22 @@
|
||||
class InvalidParameter(ValueError):
|
||||
"""Raised when a command line parameter is invalid (either missing or wrong)"""
|
||||
|
||||
def __init__(self, msg, **kwargs):
|
||||
self.msg = msg
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
||||
class InvalidKey(Exception):
|
||||
"""Raised when there is an error loading the keys"""
|
||||
|
||||
def __init__(self, msg, **kwargs):
|
||||
self.reason = msg
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
||||
class TowerResponseError(Exception):
|
||||
"""Raised when the tower responds with an error"""
|
||||
|
||||
def __init__(self, msg, **kwargs):
|
||||
self.reason = msg
|
||||
self.kwargs = kwargs
|
||||
Reference in New Issue
Block a user