go-errors / errors

errors with stacktraces for go
https://godoc.org/github.com/go-errors/errors
MIT License
921 stars 93 forks source link

Panics aren't handled correctly #6

Open akalin-keybase opened 8 years ago

akalin-keybase commented 8 years ago

The docs for runtime.Callers() ( https://golang.org/pkg/runtime/#Callers ) says:

To look up the file and line number of the call itself, use pc[i]-1. As an exception to this rule, if pc[i-1] corresponds to the function runtime.sigpanic, then pc[i] is the program counter of a faulting instruction and should be used without any subtraction.

It doesn't look like this library implements the second part, since it only converts a frame one at a time.

If I get some time, I can do a pull request. I'd like to add an argument to NewStackFrame(), like bool triggeredPanic or something, but I don't know how much code actually calls that directly.