[vlc-devel] commit: python-ctypes: raise a LibVLCException in case of error ( Olivier Aubert )
git version control
git at videolan.org
Tue Aug 4 17:17:10 CEST 2009
vlc | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Tue Aug 4 16:38:52 2009 +0200| [60fb88bd3197704c88f49420b248ff874cf1b878] | committer: Olivier Aubert
python-ctypes: raise a LibVLCException in case of error
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60fb88bd3197704c88f49420b248ff874cf1b878
---
bindings/python-ctypes/header.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/bindings/python-ctypes/header.py b/bindings/python-ctypes/header.py
index 046aedc..e375ef8 100755
--- a/bindings/python-ctypes/header.py
+++ b/bindings/python-ctypes/header.py
@@ -70,8 +70,15 @@ class ListPOINTER(object):
if isinstance(param, (list,tuple)):
return (self.etype * len(param))(*param)
+class LibVLCException(Exception):
+ """Python exception raised by libvlc methods.
+ """
+ pass
+
# From libvlc_structures.h
class VLCException(ctypes.Structure):
+ """libvlc exception.
+ """
_fields_= [
('raised', ctypes.c_int),
('code', ctypes.c_int),
@@ -163,10 +170,10 @@ def check_vlc_exception(result, func, args):
"""Error checking method for functions using an exception in/out parameter.
"""
ex=args[-1]
- # Take into account both VLCException and MediacontrolException
+ # Take into account both VLCException and MediacontrolException:
c=getattr(ex, 'raised', getattr(ex, 'code', 0))
if c:
- raise Exception(args[-1].message)
+ raise LibVLCException(args[-1].message)
return result
### End of header.py ###
More information about the vlc-devel
mailing list