From eda907fc86ebebc152966abfe178a55efa59a86a Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Sun, 26 Feb 2023 22:25:57 +0100 Subject: [PATCH] better error message if import fails, only stack traces for unexpected panics (i.e. not the special sential panic value) --- import.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/import.go b/import.go index 260550a..95162cc 100644 --- a/import.go +++ b/import.go @@ -199,9 +199,13 @@ func importctl(ctl *ctl, mbox bool) { return } - ctl.log.Error("store error", mlog.Field("panic", x)) - debug.PrintStack() - metrics.PanicInc("import") + if x != ctl.x { + ctl.log.Error("import error", mlog.Field("panic", fmt.Errorf("%v", x))) + debug.PrintStack() + metrics.PanicInc("import") + } else { + ctl.log.Error("import error") + } for _, id := range deliveredIDs { p := a.MessagePath(id) @@ -209,7 +213,7 @@ func importctl(ctl *ctl, mbox bool) { ctl.log.Check(err, "closing message file after import error", mlog.Field("path", p)) } - ctl.xerror(fmt.Sprintf("%v", x)) + ctl.xerror(fmt.Sprintf("import error: %v", x)) }() var changes []store.Change