summaryrefslogtreecommitdiff
path: root/lib/rest-client-wrapper.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-03-02 09:40:08 +0000
committerChristoph Helma <helma@in-silico.ch>2012-03-02 09:40:08 +0000
commit53fe462b9c310bc84df50d058500772b7f3cbc3c (patch)
tree7858894c334cf5847c27c3b90cfee846891f89e6 /lib/rest-client-wrapper.rb
parentcbc5f08e92c92601009f0c11c8ec67ede2894858 (diff)
error test fixed
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 0780dd5..17e1cd0 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::Error.new 400, "Invalid URI: '#{uri}'" unless URI.valid? uri
- raise OpenTox::Error.new 400, "Unreachable URI: '#{uri}'" unless URI.accessible? uri
- raise OpenTox::Error.new 400, "Headers are not a hash: #{headers.inspect}" unless headers==nil or headers.is_a?(Hash)
+ 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)
# make sure that no header parameters are set in the payload
[:accept,:content_type,:subjectid].each do |header|
- raise OpenTox::Error.new 400, "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header]
+ raise OpenTox::BadRequestError.new "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header]
end
- raise OpenTox::Error.new 400, "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)
+ 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)
begin