def fail(exc_type, exc_val, exc_tb):
    """
    Transitions the execution to fail with a specific error.

    This will prompt the execution of any RequestTemplate.after_exception hooks.

    Args:
        exc_type: The exception class.
        exc_val: The exception object.
        exc_tb: The exception's stacktrace.
    """

    def action(state):
        return state.fail(exc_type, exc_val, exc_tb)

    return action