Skip to content

Commit d022f67

Browse files
committed
Document where JackError is raised explicitly
Signed-off-by: Christopher Arndt <[email protected]>
1 parent 5205abf commit d022f67

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

src/jack.py

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ def __init__(self, name, use_exact_name=False, no_start_server=False,
159159
Pass a SessionID Token. This allows the sessionmanager to
160160
identify the client again.
161161
162+
Raises
163+
------
164+
JackOpenError
165+
If the session with the JACK server could not be opened.
166+
162167
"""
163168
status = _ffi.new('jack_status_t*')
164169
options = _lib.JackNullOption
@@ -209,7 +214,14 @@ def name(self):
209214

210215
@property
211216
def uuid(self):
212-
"""The UUID of the JACK client (read-only)."""
217+
"""The UUID of the JACK client (read-only).
218+
219+
Raises
220+
------
221+
JackError
222+
If getting the UUID fails.
223+
224+
"""
213225
uuid = _ffi.gc(_lib.jack_client_get_uuid(self._ptr), _lib.jack_free)
214226
if not uuid:
215227
raise JackError('Unable to get UUID')
@@ -439,6 +451,12 @@ def connect(self, source, destination):
439451
--------
440452
OwnPort.connect, disconnect
441453
454+
Raises
455+
------
456+
JackError
457+
If there is already an existing connection between *source* and
458+
*destination* or the connection can not be established.
459+
442460
"""
443461
if isinstance(source, Port):
444462
source = source.name
@@ -1438,6 +1456,11 @@ def get_uuid_for_client_name(self, name):
14381456
The session manager needs this to reassociate a client name to
14391457
the session ID.
14401458
1459+
Raises
1460+
------
1461+
JackError
1462+
If no client with the given name exists.
1463+
14411464
"""
14421465
uuid = _ffi.gc(_lib.jack_get_uuid_for_client_name(
14431466
self._ptr, name.encode()), _lib.jack_free)
@@ -1451,6 +1474,11 @@ def get_client_name_by_uuid(self, uuid):
14511474
In order to snapshot the graph connections, the session manager
14521475
needs to map session IDs to client names.
14531476
1477+
Raises
1478+
------
1479+
JackError
1480+
If no client with the given UUID exists.
1481+
14541482
"""
14551483
name = _ffi.gc(_lib.jack_get_client_name_by_uuid(
14561484
self._ptr, uuid.encode()), _lib.jack_free)
@@ -1464,6 +1492,11 @@ def get_port_by_name(self, name):
14641492
Given a full port name, this returns a `Port`, `MidiPort`,
14651493
`OwnPort` or `OwnMidiPort` object.
14661494
1495+
Raises
1496+
------
1497+
JackError
1498+
If no port with the given name exists.
1499+
14671500
"""
14681501
port_ptr = _lib.jack_port_by_name(self._ptr, name.encode())
14691502
if not port_ptr:
@@ -1678,7 +1711,15 @@ def callback_decorator(python_callable):
16781711
return callback_decorator
16791712

16801713
def _register_port(self, name, porttype, is_terminal, is_physical, flags):
1681-
"""Create a new port."""
1714+
"""Create a new port.
1715+
1716+
Raises
1717+
------
1718+
JackError
1719+
If the port can not be registered, e.g. because the name is
1720+
non-unique or too long.
1721+
1722+
"""
16821723
if is_terminal:
16831724
flags |= _lib.JackPortIsTerminal
16841725
if is_physical:
@@ -2330,6 +2371,12 @@ def __init__(self, size):
23302371
reserved for internal use. Use `write_space` to
23312372
determine the actual size available for writing.
23322373
2374+
2375+
Raises
2376+
------
2377+
JackError
2378+
If the rightbufefr could not be allocated.
2379+
23332380
"""
23342381
ptr = _lib.jack_ringbuffer_create(size)
23352382
if not ptr:

0 commit comments

Comments
 (0)