addErrorContext returns a new error enhanced with information from d.errorContext
(err error)
| 302 | |
| 303 | // addErrorContext returns a new error enhanced with information from d.errorContext |
| 304 | func (d *decodeState) addErrorContext(err error) error { |
| 305 | if d.errorContext.Struct != nil || d.errorContext.Field != "" { |
| 306 | switch err := err.(type) { |
| 307 | case *UnmarshalTypeError: |
| 308 | err.Struct = d.errorContext.Struct.Name() |
| 309 | err.Field = d.errorContext.Field |
| 310 | return err |
| 311 | } |
| 312 | } |
| 313 | return err |
| 314 | } |
| 315 | |
| 316 | // skip scans to the end of what was started. |
| 317 | func (d *decodeState) skip() { |