summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-03-08 18:54:47 +0000
committerChristoph Helma <helma@in-silico.ch>2012-03-08 18:54:47 +0000
commit99691a04485b409ede5b4a1c6657ba6e59abc7de (patch)
treefd35fa9b5a8a9e7678464744bb32ed766af4f2cb
parentd6482ea41cceaa741dc47192dfea6e5482d17a30 (diff)
error handling fixed
-rw-r--r--lib/opentox.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb
index 16646c1..4ca154c 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -10,10 +10,12 @@ module OpenTox
# use OpenTox error handling
set :raise_errors, false
set :show_exceptions, false
+ set :static, false
error do
+ # TODO: set actor, calling OT::Error with uri parameter does not work
error = request.env['sinatra.error']
- error.report.actor = "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}#{request.env['REQUEST_URI']}"
+ #error.report.actor = "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}#{request.env['REQUEST_URI']}"
case request.env['HTTP_ACCEPT']
when 'application/rdf+xml'
content_type 'application/rdf+xml'
@@ -25,7 +27,6 @@ module OpenTox
content_type "text/turtle"
end
if error.respond_to? :report
- code = error.report.http_code
case request.env['HTTP_ACCEPT']
when 'application/rdf+xml'
body = error.report.to_rdfxml
@@ -41,8 +42,9 @@ module OpenTox
body = error.message
body += "\n#{error.backtrace}"
end
-
- halt code, body
+ code = error.http_code if error.respond_to? :http_code
+ code ||= 500
+ halt code, error.report.to_turtle
end
end
end