Method: Billogram::Error.error_class

Defined in:
lib/billogram/error.rb

.error_class(response) ⇒ Object


16
17
18
19
20
21
22
23
24
25
# File 'lib/billogram/error.rb', line 16

def error_class(response)
  case response.code.to_i
  when 400  then BadRequest
  when 401  then Unauthorized
  when 403  then Forbidden
  when 404  then NotFound
  when 500  then InternalServerError
  else           Billogram::Error
  end
end