diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-06-17 00:12:50 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-06-17 00:12:50 +0200 |
commit | 4c76f80407d61cce9062659a3d041f55980d9cd3 (patch) | |
tree | 877577e745b0e670f4c65a24cb2da7526acba80d /reach_reports/reach_application.rb | |
parent | 654ff16ab0c63c9125785e9fe6546973cfe462a7 (diff) | |
parent | e06c018afbae2066950bc1cd43262cf7a501ba90 (diff) |
Merge branch 'development' of github.com:opentox/validation into development
Diffstat (limited to 'reach_reports/reach_application.rb')
-rwxr-xr-x | reach_reports/reach_application.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index aa64ea2..c0e89b5 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -18,14 +18,14 @@ def mysql_lite_retry( n_times=15 ) end yield # try a last time end - + require 'reach_reports/reach_persistance.rb' require 'reach_reports/reach_service.rb' require "lib/format_util.rb" def extract_type(params) - halt 400, "illegal type, neither QMRF nor QPRF: "+params[:type] unless params[:type] && params[:type] =~ /(?i)Q(M|P)RF/ + raise OpenTox::BadRequestError.new "illegal type, neither QMRF nor QPRF: "+params[:type] unless params[:type] && params[:type] =~ /(?i)Q(M|P)RF/ params.delete("type") end @@ -100,7 +100,7 @@ get '/reach_report/:type/:id' do case request.env['HTTP_ACCEPT'].to_s when "application/rdf+xml" - halt 400, "application/rdf+xml not yet supported" + raise OpenTox::BadRequestError.new "application/rdf+xml not yet supported" owl = OpenTox::Owl.create(type+"Report",rep.report_uri) owl.set_data( rep.get_content.keys_to_rdf_format ) owl.rdf @@ -121,7 +121,7 @@ get '/reach_report/:type/:id' do content_type "application/x-yaml" rep.to_yaml else - halt 400, "MIME type '"+request.env['HTTP_ACCEPT'].to_s+"' not supported, valid Accept-Headers are \"application/rdf+xml\", \"application/x-yaml\", \"application/qmrf-xml\"." + raise OpenTox::BadRequestError.new "MIME type '"+request.env['HTTP_ACCEPT'].to_s+"' not supported, valid Accept-Headers are \"application/rdf+xml\", \"application/x-yaml\", \"application/qmrf-xml\"." end end @@ -132,7 +132,7 @@ post '/reach_report/:type/:id' do rep = ReachReports.get_report(type, params[:id]) input = request.env["rack.input"].read - halt 400, "no xml data specified" unless input && input.to_s.size>0 + raise OpenTox::BadRequestError.new "no xml data specified" unless input && input.to_s.size>0 LOGGER.debug "size of posted data: "+input.to_s.size.to_s ReachReports::QmrfReport.from_xml(rep,input) |