MCPcopy Create free account
hub / github.com/antonmedv/gitmal / applyError

Function applyError

pkg/gitdiff/apply.go:64–87  ·  view source on GitHub ↗

applyError creates a new *ApplyError wrapping err or augments the information in err with args if it is already an *ApplyError. Returns nil if err is nil.

(err error, args ...interface{})

Source from the content-addressed store, hash-verified

62// applyError creates a new *ApplyError wrapping err or augments the information
63// in err with args if it is already an *ApplyError. Returns nil if err is nil.
64func applyError(err error, args ...interface{}) error {
65 if err == nil {
66 return nil
67 }
68
69 e, ok := err.(*ApplyError)
70 if !ok {
71 if err == io.EOF {
72 err = io.ErrUnexpectedEOF
73 }
74 e = &ApplyError{err: err}
75 }
76 for _, arg := range args {
77 switch v := arg.(type) {
78 case lineNum:
79 e.Line = int64(v) + 1
80 case fragNum:
81 e.Fragment = int(v) + 1
82 case fragLineNum:
83 e.FragmentLine = int(v) + 1
84 }
85 }
86 return e
87}
88
89var (
90 errApplyInProgress = errors.New("gitdiff: incompatible apply in progress")

Callers 3

ApplyFragmentMethod · 0.85
ApplyFunction · 0.85
ApplyFragmentMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected