2021-11-21 15:13:43 +00:00
|
|
|
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/interceptors"
|
2021-11-21 15:13:43 +00:00
|
|
|
)
|
|
|
|
|
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-21 15:13:43 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 17:22:57 +00:00
|
|
|
func (i *recovery) UnaryServerInterceptor() grpc.UnaryServerInterceptor {
|
|
|
|
return grpc_recovery.UnaryServerInterceptor(i.opts...)
|
2021-11-21 15:13:43 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 17:22:57 +00:00
|
|
|
func (i *recovery) StreamServerInterceptor() grpc.StreamServerInterceptor {
|
|
|
|
return grpc_recovery.StreamServerInterceptor(i.opts...)
|
2021-11-21 15:13:43 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 17:22:57 +00:00
|
|
|
func (i *recovery) UnaryClientInterceptor() grpc.UnaryClientInterceptor {
|
2021-11-21 15:13:43 +00:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-11-25 17:22:57 +00:00
|
|
|
func (i *recovery) StreamClientInterceptor() grpc.StreamClientInterceptor {
|
2021-11-21 15:13:43 +00:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|