This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/main by this push:
     new 98d99a5  Show tracebacks in development environments
98d99a5 is described below

commit 98d99a5dc44cdcd55d74db24faa5bda608ae6836
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Jan 22 16:17:08 2026 +0000

    Show tracebacks in development environments
---
 atr/server.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/atr/server.py b/atr/server.py
index d1bbc57..f6eeb9b 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -741,14 +741,24 @@ async def _register_recurrent_tasks() -> None:
         log.exception(f"Failed to schedule recurrent tasks: {e!s}")
 
 
-def _register_routes(app: base.QuartApp) -> None:
+def _register_routes(app: base.QuartApp) -> None:  # noqa: C901
     # Add a global error handler to show helpful error messages with tracebacks
     @app.errorhandler(Exception)
     async def handle_any_exception(error: Exception) -> Any:
+        import traceback
+
         if quart.request.path.startswith("/api"):
             status_code = getattr(error, "code", 500) if isinstance(error, 
Exception) else 500
             return quart.jsonify({"error": str(error)}), status_code
+
         log.exception("Unhandled exception")
+        if util.is_dev_environment():
+            return await template.render(
+                "error.html",
+                error=str(error),
+                traceback=traceback.format_exc(),
+                status_code=500,
+            ), 500
         return await template.render("error.html", error=str(error), 
status_code=500), 500
 
     @app.errorhandler(base.ASFQuartException)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to