feat: actually bubble up errors
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-11-24 10:47:30 +01:00
parent 14371cdfd7
commit ea5287152c

View File

@@ -197,6 +197,7 @@ impl Mad {
futures.push(channel.recv());
}
let mut errors = Vec::new();
while let Some(Some(msg)) = futures.next().await {
match msg.res {
Err(e) => {
@@ -205,6 +206,7 @@ impl Mad {
component = msg.name,
"component ran to completion with error"
);
errors.push(e);
}
Ok(_) => {
tracing::debug!(component = msg.name, "component ran to completion");
@@ -215,6 +217,9 @@ impl Mad {
}
tracing::debug!("ran components");
if !errors.is_empty() {
return Err(MadError::AggregateError(AggregateError { errors }));
}
Ok(())
}