lib/travis/client/session.rb in travis-1.6.18.travis.609.5 vs lib/travis/client/session.rb in travis-1.6.18.travis.610.5
- old
+ new
@@ -211,14 +211,15 @@
case result.status
when 0 then raise Travis::Client::Error, 'SSL error: could not verify peer'
when 200..299 then JSON.parse(result.body) rescue result.body
when 301, 303 then raw(:get, result.headers['Location'])
when 302, 307, 308 then raw(verb, result.headers['Location'])
- when 401 then raise Travis::Client::NotLoggedIn, 'not logged in'
- when 403 then raise Travis::Client::NotLoggedIn, 'invalid access token'
- when 404 then raise Travis::Client::NotFound, result.body
- when 400..499 then raise Travis::Client::Error, result.status
- when 500..599 then raise Travis::Client::Error, "server error (#{result.status})"
+ when 401 then raise Travis::Client::NotLoggedIn, 'not logged in'
+ when 403 then raise Travis::Client::NotLoggedIn, 'invalid access token'
+ when 404 then raise Travis::Client::NotFound, result.body
+ when 422 then raise Travis::Client::ValidationFailed, result.body
+ when 400..499 then raise Travis::Client::Error, "%s: %p" % [result.status, result.body]
+ when 500..599 then raise Travis::Client::Error, "server error (%s: %p)" % [result.status, result.body]
else raise Travis::Client::Error, "unhandled status code #{result.status}"
end
end
def inspect