mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 07:19:41 +02:00
feat(migrations): add more logging EE-2071 (#6141)
* add stacktrace when recovering a panic * add logging to the migrations * use string format * add context around why we return stacktrace
This commit is contained in:
parent
2555dfc78b
commit
d091b343b9
12 changed files with 33 additions and 3 deletions
|
@ -2,6 +2,7 @@ package bolt
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/portainer/portainer/api/cli"
|
||||
|
||||
|
@ -22,7 +23,8 @@ func (store *Store) FailSafeMigrate(migrator *migrator.Migrator) (err error) {
|
|||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
store.Rollback(true)
|
||||
err = fmt.Errorf("%v", e)
|
||||
// return error with cause and stacktrace (recover() doesn't include a stacktrace)
|
||||
err = fmt.Errorf("%v %s", e, string(debug.Stack()))
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue