lib/cfoundry/v1/base.rb in cfoundry-0.3.61 vs lib/cfoundry/v1/base.rb in cfoundry-0.4.0
- old
+ new
@@ -169,13 +169,15 @@
response.body
end
when Net::HTTPBadRequest, Net::HTTPForbidden, Net::HTTPNotFound,
Net::HTTPInternalServerError, Net::HTTPNotImplemented,
- Net::HTTPBadGateWay
+ Net::HTTPBadGateway
begin
info = parse_json(response.body)
- cls = CFoundry::APIError.v1_classes[info[:code]]
+ return super unless info[:code]
+
+ cls = CFoundry::APIError.error_classes[info[:code]]
raise (cls || CFoundry::APIError).new(info[:code], info[:description])
rescue MultiJson::DecodeError
super
end