-
-
Notifications
You must be signed in to change notification settings - Fork 2
incendium.util.get_function_name
César Román edited this page Feb 11, 2022
·
14 revisions
Get the name of the function last called.
Returns:
- str: Function's name.
None.
import traceback
from incendium import util as _util
from incendium.exceptions import ApplicationError
def failed_function():
try:
# TODO: Do something important
except (IOError, KeyError) as e:
# An error occured.
message = "An unexpected error occurred in {}. \n{}".format(
_util.get_function_name(),
"\n".join(traceback.format_exc().splitlines()),
)
raise ApplicationError(message, e)