summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lrstanley/girc/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/lrstanley/girc/handler.go')
-rw-r--r--vendor/github.com/lrstanley/girc/handler.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/vendor/github.com/lrstanley/girc/handler.go b/vendor/github.com/lrstanley/girc/handler.go
index ec717de6..4832262a 100644
--- a/vendor/github.com/lrstanley/girc/handler.go
+++ b/vendor/github.com/lrstanley/girc/handler.go
@@ -431,17 +431,27 @@ func recoverHandlerPanic(client *Client, event *Event, id string, skip int) {
return
}
- var file string
+ var file, function string
var line int
var ok bool
- _, file, line, ok = runtime.Caller(skip)
+ var pcs [10]uintptr
+ frames := runtime.CallersFrames(pcs[:runtime.Callers(skip, pcs[:])])
+ for {
+ frame, _ := frames.Next()
+ file = frame.File
+ line = frame.Line
+ function = frame.Function
+
+ break
+ }
err := &HandlerError{
Event: *event,
ID: id,
File: file,
Line: line,
+ Func: function,
Panic: perr,
Stack: debug.Stack(),
callOk: ok,
@@ -460,6 +470,7 @@ type HandlerError struct {
ID string // ID is the CUID of the handler.
File string // File is the file from where the panic originated.
Line int // Line number where panic originated.
+ Func string // Function name where panic originated.
Panic interface{} // Panic is the error that was passed to panic().
Stack []byte // Stack is the call stack. Note you may have to skip 1 or 2 due to debug functions.
callOk bool