MCPcopy
hub / github.com/kopia/kopia / ErrorInstead

Method ErrorInstead

internal/fault/fault.go:28–34  ·  view source on GitHub ↗

ErrorInstead causes the fault to return the provided error instead of calling the method.

(err error)

Source from the content-addressed store, hash-verified

26
27// ErrorInstead causes the fault to return the provided error instead of calling the method.
28func (f *Fault) ErrorInstead(err error) *Fault {
29 f.mu.Lock()
30 f.errCallback = func() error { return err }
31 f.mu.Unlock()
32
33 return f
34}
35
36// ErrorCallbackInstead invokes the provided function to return the error instead of calling the method.
37func (f *Fault) ErrorCallbackInstead(cb func() error) *Fault {

Calls 2

LockMethod · 0.65
UnlockMethod · 0.65