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

btellier pushed a commit to branch 3.9.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 7dd360f33b4fc98d2f06289f9325f0eef030051a
Author: Benoit TELLIER <[email protected]>
AuthorDate: Wed Nov 5 07:54:05 2025 +0100

    JAMES-2314 LOG for unexpected webadmin errors (#2849)
    
    Currently, 500 errors are not explained and not logged.
    It turns out we can leverage Spark ExceptionHandler
    superclass concept to always include this log, thus
    enriching the 'internal server error' construct.
---
 .../main/java/org/apache/james/webadmin/WebAdminServer.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
index 21ba45f193..40ed9f7f18 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
@@ -221,6 +221,17 @@ public class WebAdminServer implements Startable {
                 .cause(ex)
                 .asString());
         });
+
+        service.exception(Exception.class, (ex, req, res) -> {
+            LOGGER.error("Unexpected error calling {} {}", 
req.requestMethod(), req.uri(), ex);
+            res.status(INTERNAL_SERVER_ERROR_500);
+            res.body(ErrorResponder.builder()
+                .statusCode(INTERNAL_SERVER_ERROR_500)
+                .type(SERVER_ERROR)
+                .message("WebAdmin encountered an unexpected internal error")
+                .cause(ex)
+                .asString());
+        });
     }
 
     @PreDestroy


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

Reply via email to