onelson / estuary

33 stars 8 forks source link

Remove `anyhow` adopt `thiserror`. #19

Closed onelson closed 3 years ago

onelson commented 3 years ago

The motivation for this change is mainly to do with the fact thiserror lets us chain errors together without boxing or otherwise losing the typing.

When generating HTTP responses for errors, we need to know the types of errors we're handling. Anyhow sort of sets us up to need to downcast to get the type information back whereas thiserror retains the types.

codecov[bot] commented 3 years ago

Codecov Report

Merging #19 (30c1453) into main (e532886) will increase coverage by 0.23%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   96.02%   96.25%   +0.23%     
==========================================
  Files           8        8              
  Lines         654      668      +14     
==========================================
+ Hits          628      643      +15     
+ Misses         26       25       -1     
Impacted Files Coverage Δ
src/handlers/frontend.rs 100.00% <ø> (ø)
src/handlers/registry.rs 100.00% <ø> (ø)
src/storage.rs 100.00% <ø> (ø)
src/package_index.rs 94.52% <55.55%> (+0.32%) :arrow_up:
src/handlers/git.rs 98.14% <100.00%> (+0.05%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e532886...30c1453. Read the comment docs.

onelson commented 3 years ago

There's probably plenty of room for improvement as far as providing better diagnostics or logging or whatnot, but this will at least make the error sourcing/funneling more explicit (unblocking some other frontend work).