added a lot of enums for SMP parameters

This commit is contained in:
2023-10-25 16:24:03 +02:00
parent b60d89ce0a
commit 2d0a5c2974
3 changed files with 349 additions and 99 deletions

View File

@@ -1,14 +1,29 @@
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
from backend import LrcException
def exception_decorator(*exceptions):
"""
A decorator that catches specified exceptions and raises them as LrcExceptions.
Args:
*exceptions: A variable-length argument list of exceptions to catch.
Returns:
A decorator function that can be applied to other functions.
Example:
@exception_decorator(ValueError, TypeError)
def my_function():
# code here
"""
def decorator(func):
def new_func(*args, **kwargs):
try:
ret = func(*args, **kwargs)
return ret
except exceptions as e:
raise LrcException(e)
raise LrcException(e) from e
return new_func