From f2ca545448ab8a6f654309f23cfce9416b2e9856 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Thu, 13 Jan 2011 14:02:58 +0100 Subject: find methods for algorithm and model, split method for dataset, feature_type method for model and feature, perform single predicitons in resuce block, add to-html.rb, fix handling of rest-client-wrapper --- lib/rest_client_wrapper.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib/rest_client_wrapper.rb') diff --git a/lib/rest_client_wrapper.rb b/lib/rest_client_wrapper.rb index 5f5273b..2f0e215 100644 --- a/lib/rest_client_wrapper.rb +++ b/lib/rest_client_wrapper.rb @@ -115,7 +115,7 @@ module OpenTox task = OpenTox::Task.from_yaml(res) when /text\// raise "uri list has more than one entry, should be a task" if res.content_type=~/text\/uri-list/ and res.split("\n").size > 1 #if uri list contains more then one uri, its not a task - task = OpenTox::Task.find(res.to_s) if res.to_s.uri? + task = OpenTox::Task.find(res.to_s.chomp) if res.to_s.uri? else raise "unknown content-type for task: '"+res.content_type.to_s+"'" #+"' content: "+res[0..200].to_s end @@ -151,18 +151,14 @@ module OpenTox File.new(File.join(error_dir,file_name+"_"+time+"_"+count.to_s),"w").puts(body) # handle error - # we are either in a task, or in sinatra # PENDING: always return yaml for now - if $self_task #this global var in Task.create to mark that the current process is running in a task - raise error.to_yaml # the error is caught, logged, and task state is set to error in Task.create - #elsif $sinatra #else halt sinatra - #$sinatra.halt(502,error.to_yaml) - elsif defined?(halt) - halt(502,error.to_yaml) - else #for testing purposes (if classes used directly) - raise error.to_yaml - end + # raising OpenTox::Error + # to handle the error yourself, put rest-call in begin, rescue block + # if the error is not caught: + # if we are in a task, the error is caught, logged, and task state is set to error in Task.as_task + # if we are in a default call, the error is handled in overwrite.rb to return 502 (according to OT API) + raise error.to_yaml end end end -- cgit v1.2.3