8000 GitHub - hashibuto/oof: Errors with stack traces for golang
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

hashibuto/oof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oof

Errors with stack traces for golang

Go docs

Usage

import "github.com/hashibuto/oof"

Wrap an error and include a stack trace

err := method(xyz)
if err != nil {
    return oof.Trace(err)
}

Wrap an error and include a stack trace, with an annotation

err := method(xyz)
if err != nil {
    return oof.Tracef("This is my error: %w", err)
}

Example output

2022/09/18 05:27:17 Hello, this is my error: Special error occurred: SpecialError
goroutine 7 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/hashibuto/oof.Tracef({0x52e6b9, 0x1b}, {0xc00009fee8, 0x1, 0x1})
        /home/me/oof/oof.go:67 +0xb8
github.com/hashibuto/oof.ApplicationLevelCaller1()
        /home/me/oof/oof_test.go:36 +0x99
github.com/hashibuto/oof.TestTracef(0xc000007ba0)
        /home/me/oof/oof_test.go:57 +0x25
testing.tRunner(0xc000007ba0, 0x534b20)
        /usr/local/go/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1493 +0x35f

About

Errors with stack traces for golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0