// Encodes the given error into fields of an object. A field with the given // name is added for the error message. // // If the error implements fmt.Formatter, a field with the name ${key}Verbose // is also added with the full verbose error message. // // Finally, if the error implements errorGroup (from go.uber.org/multierr) or // causer (from github.com/pkg/errors), a ${key}Causes field is added with an // array of objects containing the errors this error was comprised of. // // { // "error": err.Error(), // "errorVerbose": fmt.Sprintf("%+v", err), // "errorCauses": [ // ... // ], // } func encodeError(key string, err error, enc ObjectEncoder) (retErr error) { … } type errorGroup … type errArray … func (errs errArray) MarshalLogArray(arr ArrayEncoder) error { … } var _errArrayElemPool … type errArrayElem … func newErrArrayElem(err error) *errArrayElem { … } func (e *errArrayElem) MarshalLogArray(arr ArrayEncoder) error { … } func (e *errArrayElem) MarshalLogObject(enc ObjectEncoder) error { … } func (e *errArrayElem) Free() { … }