Commit 3a38a0e0 authored by Olivier Aubert's avatar Olivier Aubert

python-ctypes: tweak exception handling

parent c141073f
...@@ -33,6 +33,7 @@ create a libvlc Instance. From this instance, you can then create ...@@ -33,6 +33,7 @@ create a libvlc Instance. From this instance, you can then create
L{MediaPlayer} and L{MediaListPlayer} instances. L{MediaPlayer} and L{MediaListPlayer} instances.
""" """
import logging
import ctypes import ctypes
import sys import sys
...@@ -224,10 +225,13 @@ def check_vlc_exception(result, func, args): ...@@ -224,10 +225,13 @@ def check_vlc_exception(result, func, args):
"""Error checking method for functions using an exception in/out parameter. """Error checking method for functions using an exception in/out parameter.
""" """
ex=args[-1] 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: # Take into account both VLCException and MediacontrolException:
c=getattr(ex, 'raised', getattr(ex, 'code', 0)) c=getattr(ex, 'raised', getattr(ex, 'code', 0))
if c: if c:
raise LibVLCException(args[-1].message) raise LibVLCException(ex.message)
return result return result
### End of header.py ### ### End of header.py ###
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment