stratumn / go-core

Stratumn's core utilities to create decentralized applications and networks
Apache License 2.0
0 stars 0 forks source link

*: structured errors #461

Closed t-bast closed 6 years ago

t-bast commented 6 years ago

Use structured errors everywhere. Errors from external packages (outside of go-core) are always wrapped which provides a stack trace at the deepest level. Errors from dependencies inside go-core are most of the time simply forwarded (since they contain the full stack trace there's no need to re-wrap them except in a few cases).

Adding these structured errors makes the code quite bloated, but unfortunately I think that until Go 2 ships there's no free lunch: if we want useful errors in our monitoring we'll have to live with it. We can most likely refactor common patterns to make the development life a bit less painful, we'll see as we go.

There is still some work to do in two next PRs:


This change is Reviewable

codecov[bot] commented 6 years ago

Codecov Report

Merging #461 into master will decrease coverage by 0.48%. The diff coverage is 35.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #461      +/-   ##
==========================================
- Coverage   70.43%   69.94%   -0.49%     
==========================================
  Files          92       92              
  Lines        5266     5350      +84     
==========================================
+ Hits         3709     3742      +33     
- Misses       1213     1236      +23     
- Partials      344      372      +28
Impacted Files Coverage Δ
validation/flags.go 0% <ø> (ø) :arrow_up:
blockchain/btc/blockcypher/cmd.go 0% <ø> (ø) :arrow_up:
types/transaction.go 80% <ø> (ø) :arrow_up:
store/store.go 89.74% <ø> (ø) :arrow_up:
blockchain/dummytimestamper/dummytimestamper.go 64.7% <0%> (ø) :arrow_up:
bufferedbatch/batch.go 89.87% <0%> (ø) :arrow_up:
types/error.go 29.41% <0%> (+29.41%) :arrow_up:
blockchain/btc/btctimestamper/btctimestamper.go 62.5% <0%> (ø) :arrow_up:
leveldbstore/leveldbstore.go 87.5% <0%> (ø) :arrow_up:
postgresstore/evidence.go 60% <0%> (ø) :arrow_up:
... and 40 more

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 12f58de...31b6bf9. Read the comment docs.