better error message if import fails, only stack traces for unexpected panics (i.e. not the special sential panic value)

This commit is contained in:
Mechiel Lukkien 2023-02-26 22:25:57 +01:00
parent 9b3a170cc2
commit eda907fc86
No known key found for this signature in database

View file

@ -199,9 +199,13 @@ func importctl(ctl *ctl, mbox bool) {
return return
} }
ctl.log.Error("store error", mlog.Field("panic", x)) if x != ctl.x {
ctl.log.Error("import error", mlog.Field("panic", fmt.Errorf("%v", x)))
debug.PrintStack() debug.PrintStack()
metrics.PanicInc("import") metrics.PanicInc("import")
} else {
ctl.log.Error("import error")
}
for _, id := range deliveredIDs { for _, id := range deliveredIDs {
p := a.MessagePath(id) 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.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 var changes []store.Change