-
Notifications
You must be signed in to change notification settings - Fork 3
implement MultiReporter #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Cargo.toml
Outdated
| aws-config = { version = "1", optional = true } | ||
| aws-sdk-s3 = { version = "1", optional = true } | ||
| chrono = "0.4" | ||
| futures = "0.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we specify the features we want rather than relying on default features?
src/reporter/multi.rs
Outdated
| .map(|reporter| reporter.report(jfr.clone(), metadata)), | ||
| ) | ||
| .await; | ||
| // return the first error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems bad to swallow errors past the first? Since they could be totally different destination types / failure reasons?
I don't think Vec<Box<dyn std::error::Error + Send>> is good because it is unpleasant to interact with compared to something directly implementing std::error::Error.
Ideally we would fold the errors somehow, but still preserves per-reporter failure attribution.
Perhaps its worth adding an optional context() method on the Reporter trait that we default to empty, implement for S3Reporter, etc?
But even without that we could at least flatten down the errors in a way that maintains ordering if not direct context.
src/reporter/multi.rs
Outdated
| use std::fmt; | ||
|
|
||
| #[derive(Debug, thiserror::Error)] | ||
| pub struct MultiError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a doc comment, even just something simple like "this is an aggregated error that includes per-reporter report errors identified by their debug impl")
📬 Issue #, if available:
✍️ Description of changes:
🔏 By submitting this pull request