added a lot of enums for SMP parameters
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user