Very convenient if used together with a logpot:
log := logpot.WithFields(...)
...
errpot.Wrap(err, "error msg").WithFieldsFrom(log) // <-- no need add context data, use log's context
-
When
err == nil
,errpot.Wrap(err, "...")
will returnnil
, soWithField/s(...)
can't be used -
const errors should be created with
NewConstError(...)