You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/03/13 14:42:44 UTC

[PATCH core 4/6] Core: HTTP code 400 now captured by 'error' helper in Sinatra

From: Michal Fojtik <mf...@redhat.com>

Currently the 40x error codes are not captured by 'error' helper
we have in server.rb. To capture the 400 code we need to use
this helper more expecitely, givin the exception class as param.

With this patch, the 400 errors are reported correctly, using XML
or HTML view.

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/server.rb |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/server/lib/deltacloud/server.rb b/server/lib/deltacloud/server.rb
index 53dd705..d47c87f 100644
--- a/server/lib/deltacloud/server.rb
+++ b/server/lib/deltacloud/server.rb
@@ -85,6 +85,10 @@ error do
   report_error
 end
 
+error Deltacloud::ExceptionHandler::ValidationFailure do
+  report_error
+end
+
 before do
   # Respond with 400, If we don't get a http Host header,
   halt 400, "Unable to find HTTP Host header" if @env['HTTP_HOST'] == nil
-- 
1.7.9.1