Class: LogStruct::Integrations::RackErrorHandler::Middleware

Inherits:
LogStruct::Integrations::RackMiddleware show all
Defined in:
lib/log_struct/integrations/rack_error_handler/middleware.rb

Overview

Logs the errors that get past ShowExceptions, or come from the middleware outside it (an IP spoofing error from a middleware that reads remote_ip, for example), then raises them again for the server to handle as it would without LogStruct

Instance Method Summary collapse

Methods inherited from LogStruct::Integrations::RackMiddleware

#initialize

Constructor Details

This class inherits a constructor from LogStruct::Integrations::RackMiddleware

Instance Method Details

#call(env) ⇒ T.untyped

Parameters:

  • env (T.untyped)

Returns:

  • (T.untyped)


15
16
17
18
19
20
21
22
23
24
# File 'lib/log_struct/integrations/rack_error_handler/middleware.rb', line 15

def call(env)
  @app.call(env)
rescue => error
  begin
    ErrorLines.log_escaped(::ActionDispatch::Request.new(env), error)
  rescue => logging_error
    LogStruct.handle_exception(logging_error, source: Source::Internal)
  end
  raise error
end