Skip to content
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

[Merged by Bors] - feat: print more error causes #3475

Closed
wants to merge 3 commits into from
Closed

Conversation

ozgrakkurt
Copy link
Contributor

@ozgrakkurt ozgrakkurt commented Aug 18, 2023

Print more error causes. This is short term minimal change solution that just adds printing causes to thiserror derivations.

I made changes for a couple of crates, will do other ones in next PRs.

I realise this might be printing too much but I think it is still better than not printing enough in some cases. Later on we can refine it more using anyhow.

Copy link
Contributor

@EstebanBorai EstebanBorai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I love the idea I also think the more details the better!
Im just concerned about cases where formatting with {:#?} may take too many lines.

FailedPrecheck(CheckStatuses),
/// Encountered an error while performing one or more pre-checks
#[error("Failed to perform one or more pre-checks")]
#[error("Failed to perform one or more pre-checks: {0:#?}")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These kind of formats {#?} could span many lines causing upper logs to be missed by the Terminal buffer.

For these cases I think we could have a one liner, perhaps implementing a Display trait on them and have a summary of the details in a single line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense! let me try to fix this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed debug prints for now. In next iteration we can implement custom Display, I didn't want to do it now because it is typedef as Vec<_> so can't implement trait on it directly, need to make it a struct which will be a breaking change.

@@ -4,14 +4,14 @@ use thiserror::Error;
/// Possible errors from Auth
#[derive(Error, Debug)]
pub enum AuthError {
#[error("IoError")]
#[error("IoError: {0}")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's get rid of this and move to anyhow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to do anyhow, but then it requires changes in other places in the code. Want to make this change like this and do other PRs for anyhow in future.

This should still print relevant info for now

@@ -16,33 +16,33 @@ use crate::common::target::TargetError;
pub enum CliError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this and move to anyhow

Copy link
Contributor

@morenol morenol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ozgrakkurt
Copy link
Contributor Author

merging this, and working on anyhow PR now

@ozgrakkurt
Copy link
Contributor Author

bors r+

bors bot pushed a commit that referenced this pull request Aug 22, 2023
Print more error causes. This is short term minimal change solution that just adds printing causes to `thiserror` derivations.

I made changes for a couple of crates, will do other ones in next PRs.

I realise this might be printing too much but I think it is still better than not printing enough in some cases. Later on we can refine it more using `anyhow`.
@bors
Copy link

bors bot commented Aug 22, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat: print more error causes [Merged by Bors] - feat: print more error causes Aug 22, 2023
@bors bors bot closed this Aug 22, 2023
@bors bors bot deleted the fl-err branch August 22, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants