You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by jv...@redhat.com on 2012/12/19 21:30:25 UTC

DTACLOUD-398 explicitely specify errors not otherwise caught by sinatra

This patch addresses JIRA DTACLOUD-398
https://issues.apache.org/jira/browse/DTACLOUD-398

Problem:
Sinatra's "error do" clause drops non-500 errors, ignoring those
defined/raised by deltacloud.

Solution:
Explicitely specify non-500 errors defined/raised by deltacloud
to Sinatra.

Testing:
To test this I temporarily modified server/lib/deltacloud/drivers/exceptions.rb
changing the 409 code to each of the codes in question and then forcing
the resource conflict error.


[PATCH] DTACLOUD-398 explicitely specify errors not otherwise caught by sinatra

Posted by jv...@redhat.com.
From: Joe VLcek <jv...@redhat.com>

---
 server/lib/deltacloud/collections/base.rb | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/server/lib/deltacloud/collections/base.rb b/server/lib/deltacloud/collections/base.rb
index bc01eff..6562448 100644
--- a/server/lib/deltacloud/collections/base.rb
+++ b/server/lib/deltacloud/collections/base.rb
@@ -43,11 +43,18 @@ module Deltacloud::Collections
       report_error
     end
 
-    error Deltacloud::Exceptions::Conflict do
-      report_error
-    end
+    # error Deltacloud::Exceptions::ObjectNotFound do
+    #   report_error
+    # end
 
-    error Deltacloud::Exceptions::ValidationFailure do
+    error Deltacloud::Exceptions::AcceptedButNotCompletedError,
+          Deltacloud::Exceptions::ValidationFailure,
+          Deltacloud::Exceptions::AuthenticationFailure,
+          Deltacloud::Exceptions::ForbiddenError,
+          Deltacloud::Exceptions::ObjectNotFound,
+          Deltacloud::Exceptions::MethodNotAllowed,
+          Deltacloud::Exceptions::UnknownMediaTypeError,
+          Deltacloud::Exceptions::Conflict do
       report_error
     end
 
-- 
1.7.11.7