Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wrap ¶
Wrap wraps an error with the function call trace. Returns nil if the given error is nil.
Example (Default) ¶
fmt.Println(foo())
Output: runtime.main: main.main: testing.(*M).Run: testing.runExamples: testing.runExample: github.com/NikitaShlyakhtin/errtrace.ExampleWrap_default: github.com/NikitaShlyakhtin/errtrace.foo: github.com/NikitaShlyakhtin/errtrace.bar: internal error
Example (WithDelimiter) ¶
fmt.Println(foo(WithDelimiter("\n")))
Output: runtime.main main.main testing.(*M).Run testing.runExamples testing.runExample github.com/NikitaShlyakhtin/errtrace.ExampleWrap_withDelimiter github.com/NikitaShlyakhtin/errtrace.foo github.com/NikitaShlyakhtin/errtrace.bar: internal error
Example (WithHideFullPaths) ¶
fmt.Println(foo(WithHideFullPaths()))
Output: runtime.main: main.main: testing.(*M).Run: testing.runExamples: testing.runExample: errtrace.ExampleWrap_withHideFullPaths: errtrace.foo: errtrace.bar: internal error
Example (WithHidePackageNames) ¶
fmt.Println(foo(WithHidePackageNames()))
Output: main: main: Run: runExamples: runExample: ExampleWrap_withHidePackageNames: foo: bar: internal error
Types ¶
type Option ¶
type Option func(*config)
Option is a functional option for Wrap function.
func WithDelimiter ¶
WithDelimiter override the default delimiter in the function call trace.
func WithHideFullPaths ¶
func WithHideFullPaths() Option
WithHideFullPaths hide full paths in the function call trace.
func WithHidePackageNames ¶
func WithHidePackageNames() Option
WithHidePackageNames hide package names in the function call trace.
Click to show internal directories.
Click to hide internal directories.