summaryrefslogtreecommitdiff
path: root/lib/rest-client-wrapper.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-03-02 19:04:02 +0000
committerChristoph Helma <helma@in-silico.ch>2012-03-02 19:04:02 +0000
commita5f8c658ba87a00950766182966b65c65d5e2b66 (patch)
treef9dc0407178fa4a0c9a2c5a0de2add0b6883da55 /lib/rest-client-wrapper.rb
parent53fe462b9c310bc84df50d058500772b7f3cbc3c (diff)
additional OpenTox errors, *_error methods in rest-client-wrapper
Diffstat (limited to 'lib/rest-client-wrapper.rb')
-rw-r--r--lib/rest-client-wrapper.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb
index 17e1cd0..64c7d7e 100644
--- a/lib/rest-client-wrapper.rb
+++ b/lib/rest-client-wrapper.rb
@@ -28,14 +28,14 @@ module OpenTox
@request = RestClient::Request.new(args)
# check input
- raise OpenTox::BadRequestError.new "Invalid URI: '#{uri}'" unless URI.valid? uri
- raise OpenTox::BadRequestError.new "Unreachable URI: '#{uri}'" unless URI.accessible? uri
- raise OpenTox::BadRequestError.new "Headers are not a hash: #{headers.inspect}" unless headers==nil or headers.is_a?(Hash)
+ bad_request_error "Invalid URI: '#{uri}'" unless URI.valid? uri
+ bad_request_error "Unreachable URI: '#{uri}'" unless URI.accessible? uri
+ bad_request_error "Headers are not a hash: #{headers.inspect}" unless headers==nil or headers.is_a?(Hash)
# make sure that no header parameters are set in the payload
[:accept,:content_type,:subjectid].each do |header|
- raise OpenTox::BadRequestError.new "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header]
+ bad_request_error "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header]
end
- raise OpenTox::BadRequestError.new "waiting_task is not 'nil', OpenTox::SubTask or OpenTox::Task: #{waiting_task.class}" unless waiting_task.nil? or waiting_task.is_a?(OpenTox::Task) or waiting_task.is_a?(OpenTox::SubTask)
+ bad_request_error "waiting_task is not 'nil', OpenTox::SubTask or OpenTox::Task: #{waiting_task.class}" unless waiting_task.nil? or waiting_task.is_a?(OpenTox::Task) or waiting_task.is_a?(OpenTox::SubTask)
begin