summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <ch@in-silico.ch>2010-02-10 16:05:50 +0100
committerChristoph Helma <ch@in-silico.ch>2010-02-10 16:05:50 +0100
commit34fe4a160ca7002e2b166925c6721e9ba9871b3e (patch)
treeb4550e52c549a4b50d157dcd7f37514be527c325
parente18b0ffdaf603ee0d96e075b375592f9c60ec33e (diff)
Catch dataset get errors
-rw-r--r--application.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/application.rb b/application.rb
index d94ea09..8464e89 100644
--- a/application.rb
+++ b/application.rb
@@ -29,8 +29,13 @@ get '/?' do
end
get '/:id/?' do
- dataset = Dataset.get(params[:id])
- halt 404, "Dataset #{uri} not found." unless dataset
+ begin
+ dataset = Dataset.get(params[:id])
+ rescue => e
+ LOGGER.error e.message
+ LOGGER.warn e.backtrace
+ halt 404, "Dataset #{params[:id]} not found."
+ end
accept = request.env['HTTP_ACCEPT']
accept = 'application/rdf+xml' if accept == '*/*' or accept == '' or accept.nil?
case accept