1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 17:10:10 +00:00

exit: include file/line with error

This commit is contained in:
Harvey Tindall 2021-07-20 14:39:20 +01:00
parent f763cfb53a
commit a869acd5dc
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2

View File

@ -1,12 +1,15 @@
package main
import (
"fmt"
"html/template"
"log"
"os"
"path/filepath"
"time"
"github.com/hrfee/jfa-go/logger"
"github.com/pkg/browser"
)
@ -23,7 +26,7 @@ func Exit(err interface{}) {
"SanitizedLog": sanitized,
}
if err != nil {
data["Err"] = err
data["Err"] = fmt.Sprintf("%s %v", logger.Lshortfile(), err)
}
fpath := filepath.Join(temp, "jfa-go-crash-"+time.Now().Local().Format("2006-01-02T15:04:05"))
err2 = os.WriteFile(fpath+".txt", []byte(logCache), 0666)