MCPcopy Create free account
hub / github.com/kataras/iris / As

Method As

core/errgroup/errgroup.go:132–154  ·  view source on GitHub ↗

As reports whether the "target" can be used as &Error{target.Type: ?}.

(target interface{})

Source from the content-addressed store, hash-verified

130
131// As reports whether the "target" can be used as &Error{target.Type: ?}.
132func (e *Error) As(target interface{}) bool {
133 if target == nil {
134 return target == e
135 }
136
137 ok := errors.As(e.Err, target)
138 if !ok {
139 te, ok := target.(*Error)
140 if !ok {
141 return false
142 }
143
144 if te.Type != nil {
145 if te.Type != e.Type {
146 return false
147 }
148 }
149
150 return errors.As(te.Err, &e)
151 }
152
153 return ok
154}
155
156// Group is an error container of a specific Type and can have child containers per type too.
157type Group struct {

Callers 3

TestErrorAsFunction · 0.45
IsErrCanceledFunction · 0.45
handleJSONErrorFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestErrorAsFunction · 0.36