Skip to content

Commit

Permalink
add middleware error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wendelfabianchinsamy committed Nov 20, 2024
1 parent fdf9ec8 commit 4a2c641
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/middleware/compressed_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ def call(env)
env["rack.input"] = StringIO.new(extracted)
end

status, headers, response = @app.call(env)
[status, headers, response]
begin
status, headers, response = @app.call(env)
[status, headers, response]
rescue => err
Raven.capture_exception(err)
Rails.logger.error(err.inspect)
[500, {}, [{ "status": 400, "title": err.message }.to_json]]
end
end

def decode(input, content_encoding)
Expand Down

0 comments on commit 4a2c641

Please sign in to comment.