[ARVADOS] updated: 5fa38c36644bd122b8c31601aa864f05bf4fba73
git at public.curoverse.com
git at public.curoverse.com
Mon Jan 12 10:31:31 EST 2015
Summary of changes:
sdk/cli/bin/arv | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
via 5fa38c36644bd122b8c31601aa864f05bf4fba73 (commit)
from 198963abf16d86d809a6a9fde36bc9ffd74685fd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 5fa38c36644bd122b8c31601aa864f05bf4fba73
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Jan 12 10:33:36 2015 -0500
4924: Rename HTTPResponse to ArvadosAPIError. Use NET::HTTP Response titles
for error codes if no other error is available.
diff --git a/sdk/cli/bin/arv b/sdk/cli/bin/arv
index 0ecfb65..f27711f 100755
--- a/sdk/cli/bin/arv
+++ b/sdk/cli/bin/arv
@@ -222,8 +222,8 @@ def edit_and_commit_object initial_obj, tmp_stem, global_opts, &block
this_error = "YAML error parsing your input: #{e}"
elsif e.is_a? JSON::ParserError
this_error = "JSON error parsing your input: #{e}"
- elsif e.is_a? HttpResponse
- this_error = "API responded with error #{e.status}"
+ elsif e.is_a? ArvadosAPIError
+ this_error = "API responded with error #{e}"
else
this_error = "#{e.class}: #{e}"
can_retry = false
@@ -256,11 +256,7 @@ def edit_and_commit_object initial_obj, tmp_stem, global_opts, &block
nil
end
-class HttpResponse < RuntimeError
- attr_reader :status
- def initialize status
- @status = status
- end
+class ArvadosAPIError < RuntimeError
end
def check_response result
@@ -271,7 +267,10 @@ def check_response result
end
if result.response.status != 200
- raise HttpResponse.new "#{result.response.status}: " + (results['errors'] && results['errors'].join('\n') || "")
+ require 'net/http'
+ raise ArvadosAPIError.new("#{result.response.status}: #{
+ ((results['errors'] && results['errors'].join('\n')) ||
+ Net::HTTPResponse::CODE_TO_OBJ[status.to_s].to_s.sub(/^Net::HTTP/, '')).titleize}")
end
results
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list