Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Errors: thiserror + anyhow instead of failure#76

Merged
kim merged 1 commit intomasterfrom
thiserror
Mar 19, 2020
Merged

Errors: thiserror + anyhow instead of failure#76
kim merged 1 commit intomasterfrom
thiserror

Conversation

@kim
Copy link
Copy Markdown
Contributor

@kim kim commented Mar 18, 2020

Fixes #72

Note that this is on top of #70

@kim kim requested a review from a team as a code owner March 18, 2020 21:51
@kim kim requested a review from a team March 18, 2020 21:51
@kim kim changed the base branch from master to quic2 March 18, 2020 21:51
@kim
Copy link
Copy Markdown
Contributor Author

kim commented Mar 18, 2020

I'm a bit unsure about the backtrace support -- failure adds them automatically, whereas thiserror apparently requires the error variant to have a field of type Backtrace, which would add quite a bit of annoying boilerplate. Otoh, backtraces are extremely valuable for ExceptT-style error handling. I might be misunderstanding how this works, though.

@FintanH
Copy link
Copy Markdown
Contributor

FintanH commented Mar 19, 2020

I'm a bit unsure about the backtrace support -- failure adds them automatically, whereas thiserror apparently requires the error variant to have a field of type Backtrace, which would add quite a bit of annoying boilerplate. Otoh, backtraces are extremely valuable for ExceptT-style error handling. I might be misunderstanding how this works, though.

There's a curious paragraph in anyhow:

A backtrace is captured and printed with the error if the underlying error type does not already provide its own. In order to see backtraces, they must be enabled through the environment variables described in std::backtrace:

The way I read this is that they should be added automatically via anyhow as well. We would only add backtrace for the convenience of other downstream users 🤷‍♂️

Copy link
Copy Markdown
Contributor

@FintanH FintanH left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I'm going to try get the surf PR up to shape adding thiserror today :)

@kim kim changed the base branch from quic2 to master March 19, 2020 13:52
@kim kim merged commit cb778e7 into master Mar 19, 2020
@kim kim deleted the thiserror branch March 19, 2020 21:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use "thiserror" in library code

2 participants