MCPcopy Create free account
hub / github.com/chain/txvm / withData

Function withData

errors/errors.go:126–133  ·  view source on GitHub ↗

withData returns a new error that wraps err as a chain error message containing v as an extra data item. Calling Data on the returned error yields v. Note that if err already has a data item, it will not be accessible via the returned error value.

(err error, v map[string]interface{})

Source from the content-addressed store, hash-verified

124// Note that if err already has a data item,
125// it will not be accessible via the returned error value.
126func withData(err error, v map[string]interface{}) error {
127 if err == nil {
128 return nil
129 }
130 e1 := wrap(err, "", 1).(wrapperError)
131 e1.data = v
132 return e1
133}
134
135// WithData returns a new error that wraps err
136// as a chain error message containing a value of type

Callers 1

WithDataFunction · 0.85

Calls 1

wrapFunction · 0.85

Tested by

no test coverage detected