diff options
-rw-r--r-- | lib/4store.rb | 2 | ||||
-rw-r--r-- | lib/error.rb | 11 | ||||
-rw-r--r-- | lib/task.rb | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/lib/4store.rb b/lib/4store.rb index e6eb914..338573d 100644 --- a/lib/4store.rb +++ b/lib/4store.rb @@ -3,7 +3,7 @@ module OpenTox class FourStore @@accept_formats = [ "application/rdf+xml", "text/turtle", "text/plain", "text/uri-list", "text/html", 'application/sparql-results+xml' ] - @@content_type_formats = [ "application/rdf+xml", "text/turtle", "text/plain" ] + @@content_type_formats = [ "application/rdf+xml", "text/turtle", "text/plain", "application/x-turtle" ] def self.list mime_type bad_request_error "'#{mime_type}' is not a supported mime type. Please specify one of #{@@accept_formats.join(", ")} in the Accept Header." unless @@accept_formats.include? mime_type diff --git a/lib/error.rb b/lib/error.rb index 3dd2950..4fed343 100644 --- a/lib/error.rb +++ b/lib/error.rb @@ -1,7 +1,7 @@ require 'open4' # add additional fields to Exception class to format errors according to OT-API -class RuntimeError +module OpenToxError attr_accessor :http_code, :uri def initialize message, uri=nil super message @@ -46,6 +46,15 @@ class RuntimeError end +class RuntimeError + include OpenToxError +end + +# clutters log file with library errors +#class NoMethodError + #include OpenToxError +#end + module OpenTox class Error < RuntimeError diff --git a/lib/task.rb b/lib/task.rb index 3d427bc..82e1665 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -21,6 +21,7 @@ module OpenTox rescue unless $!.is_a?(RuntimeError) # PENDING: only runtime Errors are logged when raised cut_index = $!.backtrace.find_index{|line| line.match /gems\/sinatra/} + cut_index = -1 unless cut_index msg = "\nTask ERROR\n"+ "task description: #{params[RDF::DC.description]}\n"+ "task uri: #{$!.class.to_s}\n"+ |