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

serde: record errors as a struct with fields for sources #91

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Mar 7, 2022

Depends on #89

This PR changes valuable-serde's recording of dyn Error values to
record the error as a serde struct with message and source fields.
This way, we can serialize errors with source chains more nicely.

When the backtrace support for std::error::Error is stable, we could
also record backtraces as a field. We could even consider adding a build
script to detect the nightly compiler and conditionally enable a cfg
for backtrace support, but that seems better left to a follow-up.

This PR changes `valuable-serde`'s recording of `dyn Error` values to
record the error as a `serde` struct with `message` and `source` fields.
This way, we can serialize errors with source chains more nicely.

When the backtrace support for `std::error::Error` is stable, we could
also record backtraces as a field. We could even consider adding a build
script to detect the nightly compiler and conditionally enable a `cfg`
for backtrace support, but that seems better left to a follow-up.
@hawkw hawkw requested a review from taiki-e March 7, 2022 17:59
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me

@hawkw hawkw merged commit 5624fe1 into eliza/fix-error Mar 8, 2022
@taiki-e taiki-e deleted the eliza/complicated-error branch March 9, 2022 03:21
@taiki-e taiki-e restored the eliza/complicated-error branch March 10, 2022 14:12
@taiki-e
Copy link
Member

taiki-e commented Mar 10, 2022

Hmm. It looks like this was merged into #89 after #89 was merged into master.

@hawkw
Copy link
Member Author

hawkw commented Mar 10, 2022

Hmm. It looks like this was merged into #89 after #89 was merged into master.

Whoops...normally, I thought GitHub rebases branches onto master when the base branch merges, so I expected that to happen here...

@hawkw
Copy link
Member Author

hawkw commented Mar 10, 2022

@taiki-e opened #92 with the correct base branch, sorry about that!

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

2 participants