Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
syeopite committed Aug 21, 2024
1 parent 8c4fca3 commit 9c64861
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions spec/exception_handler_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ describe "Kemal::ExceptionHandler" do
response.body.should eq "Something happened"
end

it "renders custom error for a crystal exception" do
it "renders custom error for a crystal exception" do
error RuntimeError do
"A RuntimeError has occured"
end

get "/" do |env|
raise RuntimeError.new()
get "/" do
raise RuntimeError.new
end

request = HTTP::Request.new("GET", "/")
Expand All @@ -82,13 +82,13 @@ describe "Kemal::ExceptionHandler" do
response.body.should eq "A RuntimeError has occured"
end

it "renders custom error for a custom exception" do
it "renders custom error for a custom exception" do
error CustomExceptionType do
"A custom exception of CustomExceptionType has occurred"
end

get "/" do |env|
raise CustomExceptionType.new()
get "/" do
raise CustomExceptionType.new
end

request = HTTP::Request.new("GET", "/")
Expand All @@ -105,14 +105,14 @@ describe "Kemal::ExceptionHandler" do
response.body.should eq "A custom exception of CustomExceptionType has occurred"
end

it "renders custom error for a custom exception with a specific HTTP status code" do
error CustomExceptionType do | env |
it "renders custom error for a custom exception with a specific HTTP status code" do
error CustomExceptionType do |env|
env.response.status_code = 503
"A custom exception of CustomExceptionType has occurred"
end

get "/" do |env|
raise CustomExceptionType.new()
get "/" do
raise CustomExceptionType.new
end

request = HTTP::Request.new("GET", "/")
Expand Down
2 changes: 1 addition & 1 deletion src/kemal/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Kemal
HANDLERS = [] of HTTP::Handler
CUSTOM_HANDLERS = [] of Tuple(Nil | Int32, HTTP::Handler)
FILTER_HANDLERS = [] of HTTP::Handler
ERROR_HANDLERS = {} of (Int32 | Exception.class) => HTTP::Server::Context, Exception -> String
ERROR_HANDLERS = {} of (Int32 | Exception.class) => HTTP::Server::Context, Exception -> String

{% if flag?(:without_openssl) %}
@ssl : Bool?
Expand Down

0 comments on commit 9c64861

Please sign in to comment.