Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
60fb88bd
Commit
60fb88bd
authored
Aug 04, 2009
by
Olivier Aubert
Browse files
python-ctypes: raise a LibVLCException in case of error
parent
ce7e4589
Changes
1
Hide whitespace changes
Inline
Side-by-side
bindings/python-ctypes/header.py
View file @
60fb88bd
...
...
@@ -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
LibVLC
Exception
(
args
[
-
1
].
message
)
return
result
### End of header.py ###
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment