[vlc-devel] commit: python-ctypes: tweak exception handling (Olivier Aubert )

git version control git at videolan.org
Thu Sep 3 10:54:02 CEST 2009


vlc | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Thu Sep  3 09:57:03 2009 +0200| [3a38a0e0d6478f78419f2dfe313fa5c2b268310b] | committer: Olivier Aubert 

python-ctypes: tweak exception handling

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3a38a0e0d6478f78419f2dfe313fa5c2b268310b
---

 bindings/python-ctypes/header.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/bindings/python-ctypes/header.py b/bindings/python-ctypes/header.py
index 83b370f..cfe047b 100755
--- a/bindings/python-ctypes/header.py
+++ b/bindings/python-ctypes/header.py
@@ -33,6 +33,7 @@ create a libvlc Instance. From this instance, you can then create
 L{MediaPlayer} and L{MediaListPlayer} instances.
 """
 
+import logging
 import ctypes
 import sys
 
@@ -224,10 +225,13 @@ def check_vlc_exception(result, func, args):
     """Error checking method for functions using an exception in/out parameter.
     """
     ex=args[-1]
+    if not isinstance(ex, (VLCException, MediaControlException)):
+        logging.warn("python-vlc: error when processing function %s. Please report this as a bug to vlc-devel at videolan.org" % str(func))
+        return result
     # Take into account both VLCException and MediacontrolException:
     c=getattr(ex, 'raised', getattr(ex, 'code', 0))
     if c:
-        raise LibVLCException(args[-1].message)
+        raise LibVLCException(ex.message)
     return result
 
 ### End of header.py ###




More information about the vlc-devel mailing list