1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add a new exception class and handled exceptions in exception messages.

This commit is contained in:
Rupak Ganguly 2012-10-19 01:29:22 -04:00
parent 7c21f2d378
commit c87f00392a

View file

@ -20,8 +20,13 @@ module Fog
data = nil
message = nil
else
begin
data = MultiJson.decode(error.response.body)
message = data['message']
rescue MultiJson::DecodeError
data = error.response.body #### the body is not in JSON format so just return it as it is
message = data
end
end
new_error = super(error, message)
@ -33,6 +38,7 @@ module Fog
class InternalServerError < ServiceError; end
class Conflict < ServiceError; end
class NotFound < ServiceError; end
class Forbidden < ServiceError; end
class ServiceUnavailable < ServiceError; end
class BadRequest < ServiceError