mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-09-18 04:20:58 +02:00
[#7781] added panic stack trace to routine.SafeWrap and wrapped JSVM migrate arguments so that we can return a clean error with the failed filename
This commit is contained in:
+21
-1
@@ -218,7 +218,27 @@ func (p *plugin) registerMigrations() error {
|
||||
vm.Set("__hooks", absHooksDir)
|
||||
|
||||
vm.Set("migrate", func(up, down func(txApp core.App) error) {
|
||||
core.AppMigrations.Register(up, down, file)
|
||||
// note: safe wrap to capture any eventual panic and to allow
|
||||
// the error message to print the migration filename
|
||||
core.AppMigrations.Register(
|
||||
func(txApp core.App) error {
|
||||
return routine.SafeWrap(func() error {
|
||||
if up == nil {
|
||||
return nil
|
||||
}
|
||||
return up(txApp)
|
||||
})()
|
||||
},
|
||||
func(txApp core.App) error {
|
||||
return routine.SafeWrap(func() error {
|
||||
if down == nil {
|
||||
return nil
|
||||
}
|
||||
return down(txApp)
|
||||
})()
|
||||
},
|
||||
file,
|
||||
)
|
||||
})
|
||||
|
||||
if p.config.OnInit != nil {
|
||||
|
||||
Reference in New Issue
Block a user