diff --git a/config/environments/development.rb b/config/environments/development.rb index 86f13ae..b1e79eb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -60,7 +60,7 @@ use_timestamp: false, } - config.action_dispatch.show_exceptions = false + config.action_dispatch.show_exceptions = :none end #BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] diff --git a/config/environments/test.rb b/config/environments/test.rb index 0620141..041afa5 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -28,7 +28,7 @@ # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + config.action_dispatch.show_exceptions = :none # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false diff --git a/lib/middleware/compressed_requests.rb b/lib/middleware/compressed_requests.rb index 13d1493..0473fcb 100644 --- a/lib/middleware/compressed_requests.rb +++ b/lib/middleware/compressed_requests.rb @@ -29,8 +29,13 @@ 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 + Rails.logger.error(err.inspect) + [500, {}, [{"status": 500, "title": err.message}.to_json]] + end end def decode(input, content_encoding)