Documentation
¶
Overview ¶
Package agherr contains AdGuard Home's error handling helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Annotate ¶ added in v0.106.0
Annotate annotates the error with the message, unless the error is nil. This is a helper function to simplify code like this:
func (f *foo) doStuff(s string) (err error) { defer func() { if err != nil { err = fmt.Errorf("bad foo string %q: %w", s, err) } }() // … }
Instead, write:
func (f *foo) doStuff(s string) (err error) { defer agherr.Annotate("bad foo string %q: %w", &err, s) // … }
msg must contain the final ": %w" verb.
TODO(a.garipov): Clearify the function usage.
Types ¶
Click to show internal directories.
Click to hide internal directories.