chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfermig...@apache.org
Subject svn commit: r1032641 - in /incubator/chemistry/cmislib/trunk/src/cmislib: exceptions.py model.py
Date Mon, 08 Nov 2010 17:01:11 GMT
Author: sfermigier
Date: Mon Nov  8 17:01:10 2010
New Revision: 1032641

URL: http://svn.apache.org/viewvc?rev=1032641&view=rev
Log:
Better error reporting.


Modified:
    incubator/chemistry/cmislib/trunk/src/cmislib/exceptions.py
    incubator/chemistry/cmislib/trunk/src/cmislib/model.py

Modified: incubator/chemistry/cmislib/trunk/src/cmislib/exceptions.py
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/cmislib/exceptions.py?rev=1032641&r1=1032640&r2=1032641&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/cmislib/exceptions.py (original)
+++ incubator/chemistry/cmislib/trunk/src/cmislib/exceptions.py Mon Nov  8 17:01:10 2010
@@ -18,7 +18,10 @@ class CmisException(Exception):
     Common base class for all exceptions.
     """
 
-    pass
+    def __init__(self, status=None, url=None):
+        Exception.__init__(self, "Error %s at %s" % (status, url))
+        self.status = status
+        self.url = url
 
 
 class InvalidArgumentException(CmisException):

Modified: incubator/chemistry/cmislib/trunk/src/cmislib/model.py
URL: http://svn.apache.org/viewvc/incubator/chemistry/cmislib/trunk/src/cmislib/model.py?rev=1032641&r1=1032640&r2=1032641&view=diff
==============================================================================
--- incubator/chemistry/cmislib/trunk/src/cmislib/model.py (original)
+++ incubator/chemistry/cmislib/trunk/src/cmislib/model.py Mon Nov  8 17:01:10 2010
@@ -156,7 +156,7 @@ class CmisClient(object):
             if idElement[0].childNodes[0].data == repositoryId:
                 return Repository(self, workspaceElement)
 
-        raise ObjectNotFoundException
+        raise ObjectNotFoundException(url=self.repositoryUrl)
 
     def getDefaultRepository(self):
 
@@ -298,20 +298,21 @@ class CmisClient(object):
         See CMIS specification document 3.2.4.1 Common CMIS Exceptions
         """
 
+
         if error.status == 401:
-            raise PermissionDeniedException(error.status)
+            raise PermissionDeniedException(error.status, error.url)
         elif error.status == 400:
-            raise InvalidArgumentException(error.status)
+            raise InvalidArgumentException(error.status, error.url)
         elif error.status == 404:
-            raise ObjectNotFoundException(error.status)
+            raise ObjectNotFoundException(error.status, error.url)
         elif error.status == 403:
-            raise PermissionDeniedException(error.status)
+            raise PermissionDeniedException(error.status, error.url)
         elif error.status == 405:
-            raise NotSupportedException(error.status)
+            raise NotSupportedException(error.status, error.url)
         elif error.status == 409:
-            raise UpdateConflictException(error.status)
+            raise UpdateConflictException(error.status, error.url)
         elif error.status == 500:
-            raise RuntimeException(error.status)
+            raise RuntimeException(error.status, error.url)
 
     defaultRepository = property(getDefaultRepository)
     repositories = property(getRepositories)



Mime
View raw message