update dependencies

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2020-12-22 16:48:26 +08:00
parent 4a11a50544
commit fe6c5de00f
2857 changed files with 252134 additions and 115656 deletions

View File

@@ -3,6 +3,8 @@
package grpc_recovery
import "context"
var (
defaultOptions = &options{
recoveryHandlerFunc: nil,
@@ -10,7 +12,7 @@ var (
)
type options struct {
recoveryHandlerFunc RecoveryHandlerFunc
recoveryHandlerFunc RecoveryHandlerFuncContext
}
func evaluateOptions(opts []Option) *options {
@@ -26,6 +28,15 @@ type Option func(*options)
// WithRecoveryHandler customizes the function for recovering from a panic.
func WithRecoveryHandler(f RecoveryHandlerFunc) Option {
return func(o *options) {
o.recoveryHandlerFunc = RecoveryHandlerFuncContext(func(ctx context.Context, p interface{}) error {
return f(p)
})
}
}
// WithRecoveryHandlerContext customizes the function for recovering from a panic.
func WithRecoveryHandlerContext(f RecoveryHandlerFuncContext) Option {
return func(o *options) {
o.recoveryHandlerFunc = f
}