tokio-rs / valuable

MIT License
185 stars 19 forks source link

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

Closed hawkw closed 2 years ago

hawkw commented 2 years ago

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.