summaryrefslogtreecommitdiff
path: root/lib/task.rb
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2013-02-04 17:39:56 +0100
committermguetlein <martin.guetlein@gmail.com>2013-02-04 17:39:56 +0100
commit01856c1edf64ca1f33e2c3c99e539f48d3d19dda (patch)
tree64865f6d943400deb8ee9560e31928483143ecb3 /lib/task.rb
parentfcc5fbca80bfd9fa67e4b83d1e8548457c4c3d10 (diff)
add pending fix to log non-runtime-errors
Diffstat (limited to 'lib/task.rb')
-rw-r--r--lib/task.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/task.rb b/lib/task.rb
index 23e6e9e..315dc18 100644
--- a/lib/task.rb
+++ b/lib/task.rb
@@ -18,7 +18,16 @@ module OpenTox
begin
result_uri = yield
task.completed result_uri
- rescue
+ rescue
+ unless $!.is_a?(RuntimeError) # PENDING: only runtime Errors are logged when raised
+ cut_index = $!.backtrace.find_index{|line| line.match /gems\/sinatra/}
+ msg = "\nTask ERROR\n"+
+ "task description: #{params[RDF::DC.description]}\n"+
+ "task uri: #{$!.class.to_s}\n"+
+ "error msg: #{$!.message}\n"+
+ "error backtrace:\n#{$!.backtrace[0..cut_index].join("\n")}\n"
+ $logger.error msg
+ end
if $!.respond_to? :to_ntriples
RestClientWrapper.put(File.join(task.uri,'Error'),:errorReport => $!.to_ntriples,:content_type => 'text/plain')
else