From 814f74272a8c1b879689e754aec050c3dccd7c30 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 1 Oct 2019 10:37:14 +0200 Subject: Use normal request/response flow for 404 errors i.e. don't throw an exception if no handlers matched. This way the error_404_handler is called before all the `after` hooks are run, as one would expect. The `error_404_handler` setting is the only one without a big WARNING message in the documentation, so it ought to behave like a normal route. --- lib/TUWF.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/TUWF.pm b/lib/TUWF.pm index 651c3be..65ba6ce 100644 --- a/lib/TUWF.pm +++ b/lib/TUWF.pm @@ -387,7 +387,7 @@ sub _handle_request { } } - die TUWF::Exception->new(404) if !$han; + $self->resNotFound if !$han; # execute post request handler, if any (no need to bother doing this if the # handler threw a TUWF::Exception like with the after hooks. The @@ -457,7 +457,6 @@ sub _handle_error { utf8 => 400, json => 400, controlchar => 400, - 404 => 404, method => 405, maxpost => 413, }->{$terr} || '500'; -- cgit v1.2.3