Make error handlers also work for filters

This commit is contained in:
sdogruyol 2016-05-06 14:08:34 +03:00
parent ceb962df6b
commit 3b402586f8
1 changed files with 3 additions and 0 deletions

View File

@ -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)