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

Function Sub

errors/errors.go:176–186  ·  view source on GitHub ↗

Sub returns an error containing root as its root and taking all other metadata (stack trace, detail, message, and data items) from err. Sub returns nil when either root or err is nil. Use this when you need to substitute a new root error in place of an existing error that may already hold a stack

(root, err error)

Source from the content-addressed store, hash-verified

174// of an existing error that may already hold a stack trace
175// or other metadata.
176func Sub(root, err error) error {
177 if wrapper, ok := err.(wrapperError); ok && root != nil {
178 wrapper.root = Root(root)
179 wrapper.msg = root.Error()
180 root = wrapper
181 }
182 if err == nil {
183 return nil
184 }
185 return Wrap(root, err.Error())
186}

Callers 3

ExampleSubFunction · 0.92
ExampleSub_returnFunction · 0.92
TestSubFunction · 0.85

Calls 3

WrapFunction · 0.85
ErrorMethod · 0.80
RootFunction · 0.70

Tested by 3

ExampleSubFunction · 0.74
ExampleSub_returnFunction · 0.74
TestSubFunction · 0.68