diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-05-09 15:51:50 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-05-09 15:51:50 +0200 |
commit | a18218bd1586edd8097729d242abb8947d6988df (patch) | |
tree | e94ac3bffb25751ed7e11a626ddde8b96f1de816 /lib/rest-client-wrapper.rb | |
parent | e2e7045c3efeb59dd650b78772009281e7fa56a0 (diff) | |
parent | 0b416e3b55a9256915a2427afe5bc112bcabc203 (diff) |
development branch mergedv0.9.3
Diffstat (limited to 'lib/rest-client-wrapper.rb')
-rw-r--r-- | lib/rest-client-wrapper.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb index de1b74f..9321a75 100644 --- a/lib/rest-client-wrapper.rb +++ b/lib/rest-client-wrapper.rb @@ -26,15 +26,14 @@ module OpenTox define_singleton_method method do |uri,payload={},headers={},waiting_task=nil| # check input - bad_request_error "Headers are not a hash: #{headers.inspect}", uri unless headers==nil or headers.is_a?(Hash) + bad_request_error "Headers are not a hash: #{headers.inspect} for #{uri}." unless headers==nil or headers.is_a?(Hash) headers[:subjectid] ||= @@subjectid - bad_request_error "Invalid URI: '#{uri}'", uri unless URI.valid? uri - #resource_not_found_error "URI '#{uri}' not found.", uri unless URI.accessible?(uri, @subjectid) unless URI.ssl?(uri) + bad_request_error "Invalid URI: '#{uri}'" unless URI.valid? uri # make sure that no header parameters are set in the payload [:accept,:content_type,:subjectid].each do |header| if defined? $aa || URI(uri).host == URI($aa[:uri]).host else - bad_request_error "#{header} should be submitted in the headers", uri if payload and payload.is_a?(Hash) and payload[header] + bad_request_error "#{header} should be submitted in the headers of URI: #{uri}" if payload and payload.is_a?(Hash) and payload[header] end end @@ -72,7 +71,7 @@ module OpenTox msg = "Could not parse error response from rest call '#{method}' to '#{uri}':\n#{response}" cause = nil end - Object.method(error[:method]).call msg, uri, cause # call error method + Object.method(error[:method]).call "#{msg}, #{uri}, #{cause}" # call error method else response end |