def METHOD_NAME(datasette, request, exception):
    datasette._exception_hook_fired = (request, exception)
    if request.args.get("_custom_error"):
        return Response.text("_custom_error")
    elif request.args.get("_custom_error_async"):
        async def inner():
            return Response.text("_custom_error_async")
        return inner