You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/08/06 17:17:33 UTC

svn commit: r1154528 - /subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c

Author: hwright
Date: Sat Aug  6 15:17:32 2011
New Revision: 1154528

URL: http://svn.apache.org/viewvc?rev=1154528&view=rev
Log:
On the fs-py branch:
Set the proper error code for the generated svn_error_t, if we can get one
from the Python Exception.

* subversion/libsvn_fs_py/py_util.c
  (create_py_stack): Attempt to get the 'code' attribute from the exception,
    and use it as our apr_err code for the generated error.

Modified:
    subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c

Modified: subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c?rev=1154528&r1=1154527&r2=1154528&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c (original)
+++ subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c Sat Aug  6 15:17:32 2011
@@ -106,6 +106,18 @@ create_py_stack(PyObject *p_exception,
                           reason);
 #endif
 
+  /* If the exception object has a 'code' attribute, and it's an integer,
+     assume it's an apr_err code */
+  if (PyObject_HasAttrString(p_exception, "code"))
+    {
+      PyObject *p_code = PyObject_GetAttrString(p_exception, "code");
+
+      if (PyInt_Check(p_code))
+        err->apr_err = PyInt_AS_LONG(p_code);
+
+      Py_DECREF(p_code);
+    }
+
   Py_DECREF(p_reason);
 
   return err;