-
-
Notifications
You must be signed in to change notification settings - Fork 2
incendium.exceptions.get_function_name
César Román edited this page Apr 30, 2024
·
1 revision
Get the name of the function last called.
Returns:
-
str
: Function's name.
None.
import traceback
from incendium import constants, exceptions
from incendium.exceptions import ApplicationError
def failed_function():
try:
raise ValueError("Value Error.")
except ValueError as exc:
# An error occurred.
message = constants.UNEXPECTED_ERROR.format(
exceptions.get_function_name(),
"\n".join(traceback.format_exc().splitlines()),
)
raise ApplicationError(message, exc, exc.cause)