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

more verbose status errors

This commit is contained in:
Wesley Beary 2009-08-12 20:47:54 -07:00
parent 34b3f59da2
commit bbc75ae306

View file

@ -23,7 +23,7 @@ unless Fog.mocking?
end end
# Messages for nicer exceptions, from rfc2616 # Messages for nicer exceptions, from rfc2616
def error_message(expected, actual) def error_message(expected, actual, response)
@messages ||= { @messages ||= {
100 => 'Continue', 100 => 'Continue',
101 => 'Switching Protocols', 101 => 'Switching Protocols',
@ -65,7 +65,7 @@ unless Fog.mocking?
503 => 'Service Unavailable', 503 => 'Service Unavailable',
504 => 'Gateway Timeout' 504 => 'Gateway Timeout'
} }
"Expected(#{expected} #{@messages[expected]}) <=> Got(#{actual} #{@messages[actual]})" "Expected(#{expected} #{@messages[expected]}) <=> Got(#{actual} #{@messages[actual]}) #{response.inspect}"
end end
def request(params) def request(params)
@ -130,7 +130,7 @@ unless Fog.mocking?
end end
if params[:expects] && params[:expects] != response.status if params[:expects] && params[:expects] != response.status
raise(error_message(params[:expects], response.status)) raise(error_message(params[:expects], response.status, response))
else else
response response
end end