Module: Ichnite::ActionDispatch::StructuredExceptions

Defined in:
lib/ichnite/action_dispatch/structured_exceptions.rb

Instance Method Summary collapse

Instance Method Details

#log_errorObject



23
24
25
# File 'lib/ichnite/action_dispatch/structured_exceptions.rb', line 23

def log_error(*)
  # no-logging
end

#render_exception(_env, e) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ichnite/action_dispatch/structured_exceptions.rb', line 4

def render_exception(_env, e)
  begin
    exception_name = e.class.name
    status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_name)
    if status == 500
      ::Ichnite.log('request_error',
        at: :error,
        error: exception_name,
        message: e.message[/\A.+$/].inspect
      )
    end
  rescue Exception => e2
    # never interfere with the regular exception handling
    ::Rails.logger.error(e2.inspect)
  end

  super
end