This documentation explains how GN3 handles errors in the application.
GN3 uses app-level error handling in Flask instead of try and except blocks within individual routes.
In this approach, errors are registered and handled at the application level. For example:
def handle_generic(exc: Exception) -> Response:
    """Handle generic exceptions."""
    current_app.logger.error(exc)
    response = jsonify({
        "error": type(exc).__name__,
        "error_description": exc.args[0] if exc.args else "Generic Exception",
        "trace": traceback.format_exc()
    })
    response.status_code = 500
    return response
def register_error_handlers(app: Flask):
    """Register application-level error handlers."""
    app.register_error_handler(NotFound, page_not_found)
    app.register_error_handler(Exception, handle_generic)
@app.route('/some_route')
def some_route():
    # If an error occurs, it is handled at the app level
    data = computation()
    return jsonify(data)
For more examples in GN3, see the link below:
Related issues: