Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit 0fa830a

Browse files
committed
fix external
1 parent 5482bb5 commit 0fa830a

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

flow.go

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,29 @@ func (e *errorData) nicelyFormatted() string {
374374
return str
375375
}
376376

377-
func (ctx *Context) ErrorHTML(status int, friendly string, err error) {
377+
func (ctx *Context) ErrorHTML(status int, friendly string, errs ...error) {
378+
errStr := ""
379+
lineNumber := -1
380+
funcName := "Not Specified"
381+
fileName := "Not Specified"
378382
ctx.Add("FriendlyError", friendly)
379-
if err != nil {
380-
ctx.Add("NastyError", err.Error())
383+
if errs != nil && len(errs) > 0 {
384+
for _, err := range errs {
385+
errStr += err.Error() + "\n"
386+
}
387+
ctx.Add("NastyError", errStr)
388+
389+
// notice that we're using 1, so it will actually log the where
390+
// the error happened, 0 = this function, we don't want that.
391+
pc, file, line, _ := runtime.Caller(1)
392+
lineNumber = line
393+
funcName = runtime.FuncForPC(pc).Name()
394+
fileName = file
395+
396+
ctx.Add("LineNumber", lineNumber)
397+
ctx.Add("FuncName", funcName)
398+
ctx.Add("FileName", fileName)
399+
381400
}
382401
ctx.Add("ErrorCode", status)
383402
ctx.noTemplateHTML("error", status)

0 commit comments

Comments
 (0)