MCPcopy
hub / github.com/rs/zerolog / Err

Method Err

array.go:107–124  ·  view source on GitHub ↗

Err serializes and appends the err to the array.

(err error)

Source from the content-addressed store, hash-verified

105
106// Err serializes and appends the err to the array.
107func (a *Array) Err(err error) *Array {
108 switch m := ErrorMarshalFunc(err).(type) {
109 case nil:
110 a.buf = enc.AppendNil(enc.AppendArrayDelim(a.buf))
111 case LogObjectMarshaler:
112 a = a.Object(m)
113 case error:
114 if !isNilValue(m) {
115 a.buf = enc.AppendString(enc.AppendArrayDelim(a.buf), m.Error())
116 }
117 case string:
118 a.buf = enc.AppendString(enc.AppendArrayDelim(a.buf), m)
119 default:
120 a.buf = enc.AppendInterface(enc.AppendArrayDelim(a.buf), m)
121 }
122
123 return a
124}
125
126// Errs serializes and appends errors to the array.
127func (a *Array) Errs(errs []error) *Array {

Callers

nothing calls this directly

Calls 7

ObjectMethod · 0.95
isNilValueFunction · 0.85
AppendNilMethod · 0.65
AppendArrayDelimMethod · 0.65
AppendStringMethod · 0.65
AppendInterfaceMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected