changes exception raised by @frontend decorator

This commit is contained in:
Mose Müller 2024-02-27 16:37:43 +01:00
parent a7ce321506
commit 9616c57c38

View File

@ -27,7 +27,7 @@ class SerializationValueError(Exception):
pass pass
class KeywordArgumentError(Exception): class FunctionDefinitionError(Exception):
pass pass
@ -38,7 +38,7 @@ def frontend(func: Callable[..., Any]) -> Callable[..., Any]:
""" """
if function_has_arguments(func): if function_has_arguments(func):
raise Exception( raise FunctionDefinitionError(
"The @frontend decorator requires functions without arguments. Function " "The @frontend decorator requires functions without arguments. Function "
f"'{func.__name__}' has at least one argument. " f"'{func.__name__}' has at least one argument. "
"Please remove the argument(s) from this function to use it with the " "Please remove the argument(s) from this function to use it with the "
@ -46,7 +46,7 @@ def frontend(func: Callable[..., Any]) -> Callable[..., Any]:
) )
# Mark the function for frontend display. # Mark the function for frontend display.
func._display_in_frontend = True func._display_in_frontend = True # type: ignore
return func return func