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:
parent
7c21f2d378
commit
c87f00392a
1 changed files with 8 additions and 2 deletions
|
@ -20,8 +20,13 @@ module Fog
|
|||
data = nil
|
||||
message = nil
|
||||
else
|
||||
data = MultiJson.decode(error.response.body)
|
||||
message = data['message']
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue