MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Attributes

Function Attributes

pkg/errors/attributes.go:163–175  ·  view source on GitHub ↗

Attributes returns the attributes of the errors, if they implement Attributes(). If more than one error is passed, subsequent error attributes will be added if not set.

(err ...error)

Source from the content-addressed store, hash-verified

161// Attributes returns the attributes of the errors, if they implement Attributes().
162// If more than one error is passed, subsequent error attributes will be added if not set.
163func Attributes(err ...error) map[string]any {
164 attributes := make(map[string]any)
165 for _, err := range err {
166 if attrErr := (attributer)(nil); errors.As(err, &attrErr) {
167 for k, v := range attrErr.Attributes() {
168 if _, ok := attributes[k]; !ok {
169 attributes[k] = v
170 }
171 }
172 }
173 }
174 return attributes
175}
176
177// PublicAttributes returns the public attributes of the errors, if they implement PublicAttributes().
178// If more than one error is passed, subsequent error attributes will be added if not set.

Callers 4

TestAttributesErrorFunction · 0.92
FormatErrorFunction · 0.92
PrintStackFunction · 0.92
FieldsMethod · 0.85

Calls 2

AttributesMethod · 0.65
AsMethod · 0.45

Tested by 1

TestAttributesErrorFunction · 0.74