Created **fn_gen** repository and added python library
This commit is contained in:
3
fn_gen/errors/__init__.py
Normal file
3
fn_gen/errors/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .undefined_communication_method_error import UndefinedCommunicationMethodError
|
||||
from .value_out_of_bounds_error import ValueOutOfBoundsError
|
||||
from .undefined_value_error import UndefinedValueError
|
||||
5
fn_gen/errors/undefined_communication_method_error.py
Normal file
5
fn_gen/errors/undefined_communication_method_error.py
Normal file
@@ -0,0 +1,5 @@
|
||||
class UndefinedCommunicationMethodError(Exception):
|
||||
def __init__(self, port: str):
|
||||
method = port.split( "::" )[0]
|
||||
super().__init__( f"ERROR: Undefined Communication Exception, Method \"{method}\" is not recognized in Port \"{port}\"." )
|
||||
|
||||
4
fn_gen/errors/undefined_value_error.py
Normal file
4
fn_gen/errors/undefined_value_error.py
Normal file
@@ -0,0 +1,4 @@
|
||||
class UndefinedValueError(Exception):
|
||||
def __init__(self, value: str, expected: str):
|
||||
super().__init__( f"ERROR: Undefined Value, expected: {expected}, value: {value}." )
|
||||
|
||||
4
fn_gen/errors/value_out_of_bounds_error.py
Normal file
4
fn_gen/errors/value_out_of_bounds_error.py
Normal file
@@ -0,0 +1,4 @@
|
||||
class ValueOutOfBoundsError(Exception):
|
||||
def __init__(self, bounds: tuple[float, float] | tuple[int, int], value: float | int):
|
||||
super().__init__( f"ERROR: Value out of expected bounds, Min: {bounds[0]}, Max: {bounds[1]}, Value: {value}." )
|
||||
|
||||
Reference in New Issue
Block a user