)
if stream_ptr is None:
- raise bt2.CreationError('cannot create stream object')
+ raise bt2._MemoryError('cannot create stream object')
stream = bt2.stream._Stream._create_from_ptr(stream_ptr)
_trace_destruction_listener_from_native, listener
)
- listener_id = fn(self._ptr, listener_from_native)
- if listener_id is None:
- utils._raise_bt2_error('cannot add destruction listener to trace object')
+ status, listener_id = fn(self._ptr, listener_from_native)
+ utils._handle_func_status(
+ status, 'cannot add destruction listener to trace object'
+ )
return bt2._ListenerHandle(listener_id, self)