From: Fredrik Tolf Date: Fri, 10 Nov 2023 00:52:39 +0000 (+0100) Subject: Install some basic error handling in Dispatch. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=88db3536fe679cd2adf24b833ae55826bbf62c4a;p=jrw.git Install some basic error handling in Dispatch. --- diff --git a/src/jrw/Dispatch.java b/src/jrw/Dispatch.java index 10b0909..894bbbf 100644 --- a/src/jrw/Dispatch.java +++ b/src/jrw/Dispatch.java @@ -1,6 +1,8 @@ package jrw; import java.util.*; +import java.io.*; +import jrw.resp.*; public class Dispatch { public static Map handle(Handler handler, Request req) { @@ -10,6 +12,9 @@ public class Dispatch { return(handler.handle(req)); } catch(Restart r) { handler = r; + } catch(Throwable t) { + t.printStackTrace((PrintStream)req.env.get("jagi.errors")); + handler = new jrw.resp.HttpError(500); } } }