Skip to content

incendium.exceptions.get_function_name

César Román edited this page Apr 30, 2024 · 1 revision

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)
Clone this wiki locally