You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:40:41 UTC
svn commit: r962246 - in /incubator/deltacloud/trunk/server: server.rb
views/error.xml.haml views/errors/ views/errors/validation_failure.html.haml
views/errors/validation_failure.xml.haml
Author: lutter
Date: Thu Jul 8 23:40:41 2010
New Revision: 962246
URL: http://svn.apache.org/viewvc?rev=962246&view=rev
Log:
Error handling: changes for validation failures
* add pretty HTML output
* error.xml.haml into a errors/ subdirectory
* add a status attribute to the XML error
Added:
incubator/deltacloud/trunk/server/views/errors/
incubator/deltacloud/trunk/server/views/errors/validation_failure.html.haml
incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml
- copied, changed from r962245, incubator/deltacloud/trunk/server/views/error.xml.haml
Removed:
incubator/deltacloud/trunk/server/views/error.xml.haml
Modified:
incubator/deltacloud/trunk/server/server.rb
Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=962246&r1=962245&r2=962246&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Thu Jul 8 23:40:41 2010
@@ -73,7 +73,8 @@ error Deltacloud::Validation::Failure do
$stdout.flush
response.status = 400
respond_to do |format|
- format.xml { haml :error, :layout => false }
+ format.xml { haml :"errors/validation_failure", :layout => false }
+ format.html { haml :"errors/validation_failure" }
end
end
Added: incubator/deltacloud/trunk/server/views/errors/validation_failure.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/errors/validation_failure.html.haml?rev=962246&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/views/errors/validation_failure.html.haml (added)
+++ incubator/deltacloud/trunk/server/views/errors/validation_failure.html.haml Thu Jul 8 23:40:41 2010
@@ -0,0 +1,11 @@
+%h1 Validation Failure
+
+%p= @error.message
+
+%dl
+ %di
+ %dt Request URL
+ %dd= request.env['REQUEST_URI']
+ %di
+ %dt Parameter
+ %dd= @error.name
Copied: incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml (from r962245, incubator/deltacloud/trunk/server/views/error.xml.haml)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml?p2=incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml&p1=incubator/deltacloud/trunk/server/views/error.xml.haml&r1=962245&r2=962246&rev=962246&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/error.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml Thu Jul 8 23:40:41 2010
@@ -1,4 +1,4 @@
-%error{:url => "#{request.env['REQUEST_URI']}"}
+%error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
%parameter #{@error.name}
%message #{@error.message}
- unless @error.param.options.empty?