rocicorp / repc

The canonical Replicache client, implemented in Rust.
Other
31 stars 7 forks source link

provide custom debug output for our error types #354

Open phritz opened 3 years ago

phritz commented 3 years ago

In https://github.com/rocicorp/repc/issues/351 we can see a DbReadError and a PullFailed error. These are variants of OpenTransactionError and BeginTryPullError respectively. However when printed the name of the enum (OTE and BTPE) is not printed, just the variant (DRE and PF) is printed. This is because we derive Debug for all our errors, and the default implementation is to print the variant but not the enum name:

When derived for ... enums, it will use the name of the variant 

-- https://doc.rust-lang.org/beta/std/fmt/trait.Debug.html

We need to implement Debug for our errors such that the enum name is printed along with the variant and anything it contains.

arv commented 3 years ago

It is not clear to me if we need to print the whole call stack of errors?