grpc/interceptors/recovery/interceptors.go

25 lines
613 B
Go
Raw Normal View History

package recovery
import (
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
"google.golang.org/grpc"
2021-11-25 17:22:57 +00:00
"go.linka.cloud/grpc-toolkit/interceptors"
)
2021-11-25 17:22:57 +00:00
func NewInterceptors(opts ...grpc_recovery.Option) interceptors.ServerInterceptors {
return &recovery{opts: opts}
}
type recovery struct {
opts []grpc_recovery.Option
}
2021-11-25 17:22:57 +00:00
func (i *recovery) UnaryServerInterceptor() grpc.UnaryServerInterceptor {
return grpc_recovery.UnaryServerInterceptor(i.opts...)
}
2021-11-25 17:22:57 +00:00
func (i *recovery) StreamServerInterceptor() grpc.StreamServerInterceptor {
return grpc_recovery.StreamServerInterceptor(i.opts...)
}