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:
parent
34b3f59da2
commit
bbc75ae306
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue