MCPcopy Index your code
hub / github.com/jetify-com/devbox / ExampleError

Function ExampleError

internal/redact/redact_test.go:16–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14)
15
16func ExampleError() {
17 // Each error string in a chain of wrapped errors is redacted with a
18 // placeholder describing the error's type.
19 wrapped := errors.New("not found")
20 name := "Alex"
21 err := fmt.Errorf("error getting user %s: %w", name, wrapped)
22
23 fmt.Println("Normal:", err)
24 fmt.Println("Redacted:", Error(err))
25 // Output:
26 // Normal: error getting user Alex: not found
27 // Redacted: <redacted *fmt.wrapError>: <redacted *errors.errorString>
28}
29
30func ExampleErrorf() {
31 // Errors created with Errorf are redacted by omitting any arguments not

Callers

nothing calls this directly

Calls 1

ErrorFunction · 0.70

Tested by

no test coverage detected