mirror of
https://github.com/rclone/rclone.git
synced 2025-12-19 01:33:25 +00:00
vendor: update all dependencies
This commit is contained in:
16
vendor/github.com/pengsrc/go-shared/utils/recover.go
generated
vendored
Normal file
16
vendor/github.com/pengsrc/go-shared/utils/recover.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/pengsrc/go-shared/log"
|
||||
)
|
||||
|
||||
// Recover is a utils that recovers from panics, logs the panic (and a
|
||||
// backtrace) for functions in goroutine.
|
||||
func Recover(ctx context.Context) {
|
||||
if x := recover(); x != nil {
|
||||
log.Errorf(ctx, "Caught panic: %v, Trace: %s", x, debug.Stack())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user