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

It doesn't print the whole chain, only the last context #85

Closed
Boscop opened this issue Apr 10, 2020 · 3 comments
Closed

It doesn't print the whole chain, only the last context #85

Boscop opened this issue Apr 10, 2020 · 3 comments

Comments

@Boscop
Copy link

Boscop commented Apr 10, 2020

According to this, the Display impl prints the whole chain. But for me, eprintln!("{}", e); only prints the last added context, which is not helpful at all because even the underlying OS error is not printed.
It only prints the whole chain when I iterate manually:

		for e in e.chain() {
			eprintln!("{}", e);
		}

But this is just quick & dirty, it doesn't have the nice formatting (with "Caused by") and indentation as it should have according to the docs.

@dtolnay dtolnay closed this as completed Apr 10, 2020
@dtolnay
Copy link
Owner

dtolnay commented Apr 10, 2020

This is intentional. The ways to print other representations are shown in https://docs.rs/anyhow/1.0.28/anyhow/struct.Error.html#display-representations.

@Boscop
Copy link
Author

Boscop commented Oct 22, 2020

@dtolnay But when I use {:#} it also only prints the last cause, not the whole chain. Why?
It says:

To print causes as well using anyhow's default formatting of causes, use the alternate selector "{:#}".

So shouldn't it print all causes?

@DanielJoyce
Copy link

Yeah, this keeps biting us on the rump too.

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

No branches or pull requests

3 participants