Exception: Rescue::ApplicationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rescue/exceptions/application_error.rb

Constant Summary collapse

STATUS_CODES =
{
  40  => { http: 400, status: 'Invalid Request'     },
  49  => { http: 400, status: 'Unsupported'         },
  81  => { http: 401, status: 'Access Denied'       },
  83  => { http: 401, status: 'Expired Token'       },
  98  => { http: 403, status: 'Not Permitted'       },
  99  => { http: 403, status: 'Suspended Account'   },
  121 => { http: 410, status: 'Deleted Resources'   },
  140 => { http: 429, status: 'Rate Limit Exceeded' },
  210 => { http: 500, status: 'Internal Error'      },
  230 => { http: 503, status: 'Over Capacity'       },
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, status, message = nil) ⇒ ApplicationError

Returns a new instance of ApplicationError.



20
21
22
23
24
# File 'lib/rescue/exceptions/application_error.rb', line 20

def initialize code, status, message = nil
  @code    = code
  @status  = (message ? status : STATUS_CODES[code][:status])
  @message = message
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



17
18
19
# File 'lib/rescue/exceptions/application_error.rb', line 17

def code
  @code
end

#stautsObject

Returns the value of attribute stauts.



18
19
20
# File 'lib/rescue/exceptions/application_error.rb', line 18

def stauts
  @stauts
end