Module: Her::Errors

Defined in:
lib/her/errors.rb

Defined Under Namespace

Classes: AssociationUnknownError, BadGateway, Error, Forbidden, NotFound, ParseError, PathError, ResourceInvalid, ResponseError, ServerError, TimeOut, Unauthorized, Unavailable

Class Method Summary collapse

Class Method Details

.exception_class_for_status(status) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/her/errors.rb', line 88

def self.exception_class_for_status(status)
  errors = {
    401 => "Unauthorized",
    403 => "Forbidden",
    404 => "NotFound",
    500 => "ServerError",
    502 => "BadGateway",
    503 => "Unavailable",
    504 => "TimeOut"
  }
  if errors[status]
    "Her::Errors::#{errors[status]}".constantize
  end
end