sapling/eden/scm/lib/clidispatch
Meyer Jacobs 4ccbd119d7 debug: introduce error classification and metadata propagation
Summary:
Introduce new rust library, taggederror, which contains utilities for attaching metadata to errors. The library provides two main methods for attaching metadata to an error, the TaggedError wrapper type, and the AnyhowExt trait methods. Provides a struct, CommonMetadata, which contains all the metadata types introduced by taggederror (fault, transience, category, and typename), which can also be attached individually (and the same pattern can be used to attach other metadata).

Introduce a new native rust command, debugthrowrustexception, which causes the command to return an error, with some attached metadata.

Modify hg rust native command dispatch error handling to use debug formatter to print anyhow::Error errors. This will print out the source chain, contexts, and backtrace if available, which will cause the metadata we attach as a wrapper error or context to be printed.

Reviewed By: DurhamG

Differential Revision: D22420941

fbshipit-source-id: d38c5a10b686d86b69a2c0a19f5bcbf4ca24dff6
2020-07-15 10:03:10 -07:00
..
src debug: introduce error classification and metadata propagation 2020-07-15 10:03:10 -07:00
Cargo.toml debug: introduce error classification and metadata propagation 2020-07-15 10:03:10 -07:00