From 3a38a0e0d6478f78419f2dfe313fa5c2b268310b Mon Sep 17 00:00:00 2001 From: Olivier Aubert Date: Thu, 3 Sep 2009 09:57:03 +0200 Subject: [PATCH] python-ctypes: tweak exception handling --- bindings/python-ctypes/header.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bindings/python-ctypes/header.py b/bindings/python-ctypes/header.py index 83b370f84c..cfe047b0e9 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@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 ### -- 2.39.2