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

Function PrintStack

cmd/internal/errors/print_stack.go:26–42  ·  view source on GitHub ↗

PrintStack prints the error stack to w.

(w io.Writer, err error)

Source from the content-addressed store, hash-verified

24
25// PrintStack prints the error stack to w.
26func PrintStack(w io.Writer, err error) {
27 for i, err := range errors.Stack(err) {
28 if i == 0 {
29 fmt.Fprintln(w, err)
30 } else {
31 fmt.Fprintf(w, "--- %s\n", err)
32 }
33 for k, v := range errors.Attributes(err) {
34 fmt.Fprintf(os.Stderr, " %s=%v\n", k, v)
35 }
36 if ttnErr, ok := errors.From(err); ok {
37 if correlationID := ttnErr.CorrelationID(); correlationID != "" {
38 fmt.Fprintf(os.Stderr, " correlation_id=%s\n", ttnErr.CorrelationID())
39 }
40 }
41 }
42}

Callers 1

mainFunction · 0.92

Calls 4

StackFunction · 0.92
AttributesFunction · 0.92
FromFunction · 0.92
CorrelationIDMethod · 0.65

Tested by

no test coverage detected