diff --git a/src/kemal/common_exception_handler.cr b/src/kemal/common_exception_handler.cr index e31c4c9..2862d99 100644 --- a/src/kemal/common_exception_handler.cr +++ b/src/kemal/common_exception_handler.cr @@ -20,7 +20,7 @@ module Kemal end private def call_exception_with_status_code(context : HTTP::Server::Context, exception : Exception, status_code : Int32) - if Kemal.config.error_handlers.size != 0 && Kemal.config.error_handlers.has_key?(status_code) + if !Kemal.config.error_handlers.empty? && Kemal.config.error_handlers.has_key?(status_code) context.response.content_type = "text/html" unless context.response.headers.has_key?("Content-Type") context.response.print Kemal.config.error_handlers[status_code].call(context, exception) context.response.status_code = status_code diff --git a/src/kemal/route_handler.cr b/src/kemal/route_handler.cr index 1822b02..ded2c0b 100644 --- a/src/kemal/route_handler.cr +++ b/src/kemal/route_handler.cr @@ -33,7 +33,7 @@ module Kemal raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_defined? content = context.route.handler.call(context) - if Kemal.config.error_handlers.size != 0 && Kemal.config.error_handlers.has_key?(context.response.status_code) + if !Kemal.config.error_handlers.empty? && Kemal.config.error_handlers.has_key?(context.response.status_code) raise Kemal::Exceptions::CustomException.new(context) end