~sircmpwn/aerc

improvement: log panic stacktrace v1 PROPOSED

Jeff Martin: 1
 improvement: log panic stacktrace

 1 files changed, 8 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/11828/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] improvement: log panic stacktrace Export this patch

Write panic error and stacktrace to the apps logger. Panics that occur
while the ui is running leave the terminal in a garbled state, making it
difficult to read the stacktrace. The app log is the logical place to
write it.
---
aerc.go | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/aerc.go b/aerc.go
index 17b3c57..41e30b5 100644
--- a/aerc.go
+++ b/aerc.go
@@ -6,6 +6,7 @@ import (
	"io/ioutil"
	"log"
	"os"
	"runtime/debug"
	"sort"
	"time"

@@ -142,6 +143,13 @@ func main() {
	logger = log.New(logOut, "", log.LstdFlags)
	logger.Println("Starting up aerc")

	defer func() {
		if r := recover(); r != nil {
			logger.Println("panic:", r, "\n", string(debug.Stack()))
			panic(err)
		}
	}()

	conf, err := config.LoadConfigFromFile(nil, ShareDir)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to load config: %v\n", err)
--
2.25.1