Skip to content

Commit

Permalink
feat: macro use sink
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp committed Sep 21, 2024
1 parent e732c39 commit ed109a2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libs/error-stack/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,18 @@ macro_rules! bail {
}};

[$($err:expr),+ $(,)?] => {{
let mut error: core::result::Result<(), Report<[_]>> = core::result::Result::Ok(());
let mut sink = $crate::ReportSink::new();

$(
$crate::ResultMultiExt::accumulate(&mut error, $crate::report!($err));
sink.capture($err);
)+

return error;
let error = match sink.finish() {
Ok(()) => unreachable!(),
Err(error) => error,
};

return core::result::Result::Err(error);
}};
}

Expand Down

0 comments on commit ed109a2

Please sign in to comment.