Wrap all errors with tracerr

This commit is contained in:
Eduard S
2020-11-30 12:58:36 +01:00
parent 879af66a2a
commit ced42634da
59 changed files with 1324 additions and 1268 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/hermeznetwork/hermez-node/db/historydb"
"github.com/hermeznetwork/hermez-node/db/l2db"
"github.com/hermeznetwork/hermez-node/db/statedb"
"github.com/hermeznetwork/tracerr"
)
// TODO: Add correct values to constants
@@ -49,10 +50,10 @@ func NewAPI(
// Check input
// TODO: is stateDB only needed for explorer endpoints or for both?
if coordinatorEndpoints && l2db == nil {
return nil, errors.New("cannot serve Coordinator endpoints without L2DB")
return nil, tracerr.Wrap(errors.New("cannot serve Coordinator endpoints without L2DB"))
}
if explorerEndpoints && hdb == nil {
return nil, errors.New("cannot serve Explorer endpoints without HistoryDB")
return nil, tracerr.Wrap(errors.New("cannot serve Explorer endpoints without HistoryDB"))
}
a := &API{