incendium.exceptions.get_function_name - ignition-devs/incendium GitHub Wiki
Description
Get the name of the function last called.
Syntax
incendium.exceptions.get_function_name()
Returns:
str
: Function's name.
Recommendations
None.
Code Examples
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)