Skip to content

Commit

Permalink
feat/error: more details on which message type caused the stall (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov authored Feb 14, 2023
1 parent ced7be6 commit 4f088d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions orchestra/proc-macro/src/impl_orchestra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,12 @@ pub(crate) fn impl_orchestrated_subsystem(info: &OrchestraInfo) -> proc_macro2::
#support_crate ::tracing::error!(
target: LOG_TARGET,
%origin,
"Subsystem {} appears unresponsive.",
"Subsystem {} appears unresponsive when sending a message of type {}.",
instance.name,
::std::any::type_name::<M>(),
);
Err(#error_ty :: from(
#support_crate ::OrchestraError::SubsystemStalled(instance.name)
#support_crate ::OrchestraError::SubsystemStalled(instance.name, "message", ::std::any::type_name::<M>())
))
}
Some(res) => res.map_err(Into::into),
Expand All @@ -242,7 +243,7 @@ pub(crate) fn impl_orchestrated_subsystem(info: &OrchestraInfo) -> proc_macro2::
match instance.tx_signal.send(signal).timeout(SIGNAL_TIMEOUT).await {
None => {
Err(#error_ty :: from(
#support_crate ::OrchestraError::SubsystemStalled(instance.name)
#support_crate ::OrchestraError::SubsystemStalled(instance.name, "signal", ::std::any::type_name::<#signal>())
))
}
Some(res) => {
Expand Down
4 changes: 2 additions & 2 deletions orchestra/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ pub enum OrchestraError {
#[error("Failed to {0}")]
Context(String),

#[error("Subsystem stalled: {0}")]
SubsystemStalled(&'static str),
#[error("Subsystem stalled: {0}, source: {1}, type: {2}")]
SubsystemStalled(&'static str, &'static str, &'static str),

/// Per origin (or subsystem) annotations to wrap an error.
#[error("Error originated in {origin}")]
Expand Down

0 comments on commit 4f088d0

Please sign in to comment.