From dee8892491dcda0bfa68c413ee0fbbc0ddd33f12 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 15 Feb 2013 12:23:52 +0100 Subject: error messages in tasks fixed --- lib/task.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/task.rb') diff --git a/lib/task.rb b/lib/task.rb index 315dc18..3d427bc 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -92,27 +92,30 @@ module OpenTox while running? sleep dur dur = [[(Time.new - start_time)/20.0,0.3].max,300.0].min - time_out_error "max wait time exceeded ("+DEFAULT_TASK_MAX_DURATION.to_s+"sec), task: '"+@uri.to_s+"'" if (Time.new > due_to_time) + request_timeout_error "max wait time exceeded ("+DEFAULT_TASK_MAX_DURATION.to_s+"sec), task: '"+@uri.to_s+"'" if (Time.new > due_to_time) end end end + def code + RestClientWrapper.head(@uri).code.to_i + end + # get only header for status requests def running? - RestClientWrapper.head(@uri).code == 202 + code == 202 end def cancelled? - RestClientWrapper.head(@uri).code == 503 + code == 503 end def completed? - RestClientWrapper.head(@uri).code == 200 + code == 200 end def error? - code = RestClientWrapper.head(@uri).code code >= 400 and code != 503 end -- cgit v1.2.3