[conduit/syncml: 92/244] Be able to decode SyncML Errors...



commit 655d9c57780a50fffebb1042ab2dd33e09753083
Author: John Carr <john carr unrouted co uk>
Date:   Fri Apr 24 09:47:08 2009 -0700

    Be able to decode SyncML Errors...
---
 conduit/modules/SyncmlModule/SyncmlModule.py |    3 +--
 conduit/modules/SyncmlModule/pysyncml.py     |    7 +++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/conduit/modules/SyncmlModule/SyncmlModule.py b/conduit/modules/SyncmlModule/SyncmlModule.py
index 351808f..bb7c7be 100644
--- a/conduit/modules/SyncmlModule/SyncmlModule.py
+++ b/conduit/modules/SyncmlModule/SyncmlModule.py
@@ -54,8 +54,7 @@ class SyncmlDataProvider(DataProvider.TwoWay):
             It WILL happen in a different thread to whatever thread called syncobject.run()
         """
         if event == enums.SML_DATA_SYNC_EVENT_ERROR:
-            log.error("An error has occurred")
-            #FIXME: log error details
+            log.error("An error has occurred: %s" % err.message)
             return
 
         if event == enums.SML_DATA_SYNC_EVENT_CONNECT:
diff --git a/conduit/modules/SyncmlModule/pysyncml.py b/conduit/modules/SyncmlModule/pysyncml.py
index c596d6e..de17618 100644
--- a/conduit/modules/SyncmlModule/pysyncml.py
+++ b/conduit/modules/SyncmlModule/pysyncml.py
@@ -95,6 +95,10 @@ class Location(c_void_p):
 
 class Error(c_void_p):
 
+    @property
+    def message(self):
+        return lib.smlErrorPrint(byref(self))
+
     unref = lib.smlErrorDeref
 
 
@@ -237,6 +241,9 @@ lib.smlLocationSetName.restype = None
 lib.smlErrorDeref.argtypes = [POINTER(Error)]
 lib.smlErrorDeref.restype = None
 
+lib.smlErrorPrint.argtypes = [POINTER(Error)]
+lib.smlErrorPrint.restype = c_char_p
+
 lib.g_thread_init.argtypes = [c_void_p]
 lib.g_thread_init.restype = None
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]