Skip to content

Commit

Permalink
Merge pull request #66 from grip-framework/fix/exception_handler_bug
Browse files Browse the repository at this point in the history
fix: Return context in case the response is closed during exception handling
  • Loading branch information
grkek authored May 11, 2024
2 parents 7dbfcde + 5d6abac commit 305356f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/grip/handlers/exception.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module Grip
def call(context : HTTP::Server::Context)
call_next(context)
rescue ex
return context if context.response.closed?

context.response.status_code = 500 if !context.response.status_code.in?([400, 401, 403, 404, 405, 500])

if ex.is_a?(Grip::Exceptions::Base)
Expand Down

0 comments on commit 305356f

Please sign in to comment.