TBD54566975 / web5-rs

Apache License 2.0
8 stars 5 forks source link

Add custom `SerdeJsonError` throughout crates #165

Open kirahsapong opened 3 months ago

kirahsapong commented 3 months ago

Check crates for redundant usage of mapping serde json errors and replace with custom SerdeJsonError enums

Example in #163 - https://github.com/TBD54566975/web5-rs/pull/162/files#diff-72c9a6b1202bfaaf136121542f68f9cb3af89464ab3fe04e52d29063c986bd9eR31

KendallWeihe commented 3 months ago

The more general case would be to try and remove any case wherein we have to make a call to .map_err() (not just with the serde_json error, but of any error type which isn't already automatically mapped); instead, it would be ideal for all error mappings to occur automatically via the impl of the From trait (this way .map_err() can just be replaced with the ? operator)

This is the exact commit hash where we did this, for both the serde_json error case and the base64 error case https://github.com/TBD54566975/web5-rs/commit/6237daf6196b1e6bd9c8c5b4d7896597fa3cb562