class Airbrake::Rails::Event

def status_code

def status_code
  return @event.payload[:status] if @event.payload[:status]
  if @event.payload[:exception]
    status = ActionDispatch::ExceptionWrapper.status_code_for_exception(
      @event.payload[:exception].first,
    )
    status = 500 if status == 0
    return status
  end
  # The ActiveSupport event doesn't have status only in two cases:
  #   - an exception was thrown
  #   - unauthorized access
  # We have already handled the exception so what's left is unauthorized
  # access. There's no way to know for sure it's unauthorized access, so
  # we are rather optimistic here.
  401
end