refactor: openpitrix module
Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
32
vendor/github.com/grpc-ecosystem/go-grpc-middleware/recovery/options.go
generated
vendored
Normal file
32
vendor/github.com/grpc-ecosystem/go-grpc-middleware/recovery/options.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2017 David Ackroyd. All Rights Reserved.
|
||||
// See LICENSE for licensing terms.
|
||||
|
||||
package grpc_recovery
|
||||
|
||||
var (
|
||||
defaultOptions = &options{
|
||||
recoveryHandlerFunc: nil,
|
||||
}
|
||||
)
|
||||
|
||||
type options struct {
|
||||
recoveryHandlerFunc RecoveryHandlerFunc
|
||||
}
|
||||
|
||||
func evaluateOptions(opts []Option) *options {
|
||||
optCopy := &options{}
|
||||
*optCopy = *defaultOptions
|
||||
for _, o := range opts {
|
||||
o(optCopy)
|
||||
}
|
||||
return optCopy
|
||||
}
|
||||
|
||||
type Option func(*options)
|
||||
|
||||
// WithRecoveryHandler customizes the function for recovering from a panic.
|
||||
func WithRecoveryHandler(f RecoveryHandlerFunc) Option {
|
||||
return func(o *options) {
|
||||
o.recoveryHandlerFunc = f
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user