~sircmpwn/aerc

improvement: log panic stacktrace v2 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/11829/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH v2] 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.
---
wups, shadowed err in the last patch -_-

aerc.go | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/aerc.go b/aerc.go
index 17b3c57..964d6bf 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 err := recover(); err != nil {
			logger.Println("panic:", err, "\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
Hi,


On Fri, Jul 31, 2020 at 10:57:39PM -0700, Jeff Martin wrote: