2021-11-21 16:13:43 +01:00
|
|
|
package recovery
|
|
|
|
|
|
|
|
import (
|
|
|
|
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
|
|
|
|
"google.golang.org/grpc"
|
2021-11-25 18:22:57 +01:00
|
|
|
|
2023-07-08 01:33:10 +02:00
|
|
|
"go.linka.cloud/grpc-toolkit/interceptors"
|
2021-11-21 16:13:43 +01:00
|
|
|
)
|
|
|
|
|
2021-11-25 18:22:57 +01:00
|
|
|
func NewInterceptors(opts ...grpc_recovery.Option) interceptors.ServerInterceptors {
|
|
|
|
return &recovery{opts: opts}
|
|
|
|
}
|
|
|
|
|
|
|
|
type recovery struct {
|
|
|
|
opts []grpc_recovery.Option
|
2021-11-21 16:13:43 +01:00
|
|
|
}
|
|
|
|
|
2021-11-25 18:22:57 +01:00
|
|
|
func (i *recovery) UnaryServerInterceptor() grpc.UnaryServerInterceptor {
|
|
|
|
return grpc_recovery.UnaryServerInterceptor(i.opts...)
|
2021-11-21 16:13:43 +01:00
|
|
|
}
|
|
|
|
|
2021-11-25 18:22:57 +01:00
|
|
|
func (i *recovery) StreamServerInterceptor() grpc.StreamServerInterceptor {
|
|
|
|
return grpc_recovery.StreamServerInterceptor(i.opts...)
|
2021-11-21 16:13:43 +01:00
|
|
|
}
|