def METHOD_NAME(e: werkzeug.exceptions.InternalServerError):
    message = getattr(e, "original_exception", e.description)
    response = jsonify({"error": "Internal server error: " + str(message)})
    response.status_code = 500
    return response