-
Notifications
You must be signed in to change notification settings - Fork 72
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
feature request: Allow attaching Reports to Reports #208
Open
afmireski
wants to merge
6
commits into
eyre-rs:master
Choose a base branch
from
afmireski:198-feature-allow-attaching-reports-to-reports
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
61c1f45
feature: Add Report variant to HelpInfo
afmireski 2d9fbe4
feature: Implemented report and with_report methods for trait Section
afmireski 5f074ef
refactor: Update .report documentation
afmireski 911b196
#198 - fix: Runned cargo fmt to try fix rustfmt ci errors
afmireski 8addc8f
#198 - fix: Runned cargo clippy to try fix clippy ci errors
afmireski bc67449
#198 - chore: bump pyo3 to version 0.23.1
afmireski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use color_eyre::Section; | ||
use eyre::{eyre, Result}; | ||
|
||
fn main() -> Result<()> { | ||
color_eyre::install()?; | ||
|
||
let mut errors = vec![]; | ||
|
||
if let Err(err) = do_stuff() { | ||
errors.push(err); | ||
} | ||
|
||
if let Err(err) = do_other_stuff() { | ||
errors.push(err); | ||
} | ||
|
||
if !errors.is_empty() { | ||
let mut err = eyre!("Program failure with {} errors!", errors.len()); | ||
|
||
for error in errors { | ||
err = err.report(error); | ||
} | ||
|
||
return Err(err); | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
fn do_stuff() -> Result<()> { | ||
let err = eyre!("Some thing gets wrong"); | ||
|
||
Err(err) | ||
} | ||
|
||
fn do_other_stuff() -> Result<()> { | ||
let err = eyre!("Some other thing gets wrong"); | ||
|
||
Err(err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use color_eyre::Section; | ||
use eyre::{eyre, Result}; | ||
|
||
fn main() -> Result<()> { | ||
color_eyre::install()?; | ||
|
||
let mut errors = vec![]; | ||
|
||
if let Err(err) = do_stuff() { | ||
errors.push(err); | ||
} | ||
|
||
if let Err(err) = do_other_stuff() { | ||
errors.push(err); | ||
} | ||
|
||
if !errors.is_empty() { | ||
let final_report = eyre!("Program failure with {} errors!", errors.len()); | ||
|
||
let err = errors | ||
.into_iter() | ||
.fold(final_report, |report, r| report.with_report(|| r)); | ||
|
||
return Err(err); | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
fn do_stuff() -> Result<()> { | ||
let parameters = (1, 2, 3); | ||
let err = eyre!( | ||
"Some thing gets wrong with parameters: \n-x: {} \n-y: {} \n-z: {}", | ||
parameters.0, | ||
parameters.1, | ||
parameters.2, | ||
); | ||
|
||
Err(err) | ||
} | ||
|
||
fn do_other_stuff() -> Result<()> { | ||
let err = eyre!("Some other thing gets wrong"); | ||
|
||
Err(err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If you have any backtrace or spantrace information in this report, it won't be printed. That feels like a motivating use case for this feature