From 3b402586f88c0903f68890e4a9ed85f823f909a2 Mon Sep 17 00:00:00 2001 From: sdogruyol Date: Fri, 6 May 2016 14:08:34 +0300 Subject: [PATCH] Make error handlers also work for filters --- src/kemal/middleware/filters.cr | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/kemal/middleware/filters.cr b/src/kemal/middleware/filters.cr index b265ac0..c790c2c 100644 --- a/src/kemal/middleware/filters.cr +++ b/src/kemal/middleware/filters.cr @@ -15,6 +15,9 @@ module Kemal::Middleware return call_next(context) unless context.route_defined? call_block_for_path_type("ALL", context.request.path, :before, context) call_block_for_path_type(context.request.override_method, context.request.path, :before, context) + if Kemal.config.error_handlers.has_key?(context.response.status_code) + raise Kemal::Exceptions::CustomException.new(context) + end call_next(context) call_block_for_path_type(context.request.override_method, context.request.path, :after, context) call_block_for_path_type("ALL", context.request.path, :after, context)