As reports whether the "target" can be used as &Error{target.Type: ?}.
(target interface{})
| 130 | |
| 131 | // As reports whether the "target" can be used as &Error{target.Type: ?}. |
| 132 | func (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. |
| 157 | type Group struct { |
no outgoing calls