diff --git a/libraries/extensions/ros2-bridge/msg-gen/src/types/message.rs b/libraries/extensions/ros2-bridge/msg-gen/src/types/message.rs index cd4a92df3..8c0510a41 100644 --- a/libraries/extensions/ros2-bridge/msg-gen/src/types/message.rs +++ b/libraries/extensions/ros2-bridge/msg-gen/src/types/message.rs @@ -344,7 +344,7 @@ impl Message { #[allow(non_snake_case)] fn #publish(&mut self, message: ffi::#struct_raw_name) -> eyre::Result<()> { use eyre::Context; - self.0.publish(message).context("publish failed") + self.0.publish(message).context("publish failed").map_err(|e| eyre::eyre!("{e:?}")) } } @@ -370,7 +370,7 @@ impl Message { let result = event.event.downcast::>() .map_err(|_| eyre::eyre!("downcast to {} failed", #struct_raw_name_str))?; - let (data, _info) = result.with_context(|| format!("failed to receive {} event", #subscription_name_str))?; + let (data, _info) = result.with_context(|| format!("failed to receive {} event", #subscription_name_str)).map_err(|e| eyre::eyre!("{e:?}"))?; Ok(data) }, _ => eyre::bail!("not a {} event", #subscription_name_str), diff --git a/libraries/extensions/ros2-bridge/msg-gen/src/types/service.rs b/libraries/extensions/ros2-bridge/msg-gen/src/types/service.rs index ca1617e21..531dc7620 100644 --- a/libraries/extensions/ros2-bridge/msg-gen/src/types/service.rs +++ b/libraries/extensions/ros2-bridge/msg-gen/src/types/service.rs @@ -135,7 +135,7 @@ impl Service { &ros2_client::ServiceTypeName::new(#package_name, #self_name_str), qos.clone().into(), qos.into(), - )?; + ).map_err(|e| eyre::eyre!("{e:?}"))?; let (response_tx, response_rx) = flume::bounded(1); let stream = response_rx.into_stream().map(|v: eyre::Result<_>| Box::new(v) as Box); let id = events.events.merge(Box::pin(stream)); @@ -185,7 +185,9 @@ impl Service { use eyre::WrapErr; use futures::task::SpawnExt as _; - let request_id = futures::executor::block_on(self.client.async_send_request(request.clone())).context("failed to send request")?; + let request_id = futures::executor::block_on(self.client.async_send_request(request.clone())) + .context("failed to send request") + .map_err(|e| eyre::eyre!("{e:?}"))?; let client = self.client.clone(); let response_tx = self.response_tx.clone(); let send_result = async move { @@ -194,7 +196,7 @@ impl Service { tracing::warn!("failed to send service response"); } }; - self.executor.spawn(send_result).context("failed to spawn response task")?; + self.executor.spawn(send_result).context("failed to spawn response task").map_err(|e| eyre::eyre!("{e:?}"))?; Ok(()) } @@ -214,7 +216,8 @@ impl Service { let result = event.event.downcast::>() .map_err(|_| eyre::eyre!("downcast to {} failed", #res_type_raw_str))?; - let data = result.with_context(|| format!("failed to receive {} response", #self_name_str))?; + let data = result.with_context(|| format!("failed to receive {} response", #self_name_str)) + .map_err(|e| eyre::eyre!("{e:?}"))?; Ok(data) }, _ => eyre::bail!("not a {} response event", #self_name_str),