2424)
2525from System .Threading .Tasks import Task
2626
27+ from ..core import RosTimeoutError
2728from ..event_emitter import EventEmitterMixin
2829from . import RosBridgeException , RosBridgeProtocol
2930
@@ -131,7 +132,7 @@ def receive_chunk_async(self, task, context):
131132 if task :
132133 error_message += '; Task status: {}, Inner exception: {}' .format (task .Status , task .Exception )
133134 LOGGER .exception (error_message )
134- raise RosBridgeException (error_message ) from exception
135+ raise RosBridgeException (error_message , exception )
135136
136137 def start_listening (self ):
137138 """Starts listening asynchronously while the socket is open.
@@ -167,7 +168,7 @@ def start_listening(self):
167168 except Exception as exception :
168169 error_message = 'Exception on start_listening, processing will be aborted'
169170 LOGGER .exception (error_message )
170- raise RosBridgeException (error_message ) from exception
171+ raise RosBridgeException (error_message , exception )
171172 finally :
172173 LOGGER .debug ('Leaving the listening thread' )
173174
@@ -223,7 +224,7 @@ def send_chunk_async(self, task, message_data):
223224 except Exception as exception :
224225 error_message = 'Exception while on send_chunk_async'
225226 LOGGER .exception (error_message )
226- raise RosBridgeException (error_message ) from exception
227+ raise RosBridgeException (error_message , exception )
227228
228229 def send_message (self , payload ):
229230 """Start sending a message over the websocket asynchronously."""
@@ -244,7 +245,7 @@ def send_message(self, payload):
244245 except Exception as exception :
245246 error_message = 'Exception while sending message'
246247 LOGGER .exception (error_message )
247- raise RosBridgeException (error_message ) from exception
248+ raise RosBridgeException (error_message , exception )
248249
249250 def dispose (self , * args ):
250251 """Dispose the resources held by this protocol instance, i.e. socket."""
@@ -486,7 +487,7 @@ def raise_timeout_exception(self, _result=None, _timeout=None):
486487 Raises:
487488 An exception.
488489 """
489- raise TimeoutError ('No service response received' )
490+ raise RosTimeoutError ('No service response received' )
490491
491492 def get_inner_callback (self , result_placeholder ):
492493 """Get the callback which, when called, provides result_placeholder with the result.
0 commit comments