Skip to content

Commit

Permalink
Return context in case the response is closed during exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgi Kavrelishvili authored and Giorgi Kavrelishvili committed May 11, 2024
1 parent 7dbfcde commit 5d6abac
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 5d6abac

Please sign in to comment.