zitadel/internal/api/grpc/server/middleware/error_interceptor.go
2020-03-24 14:15:01 +01:00

17 lines
480 B
Go

package middleware
import (
"context"
"google.golang.org/grpc"
grpc_util "github.com/caos/zitadel/internal/api/grpc"
)
func ErrorHandler() func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
resp, err := handler(ctx, req)
return resp, grpc_util.CaosToGRPCError(err)
}
}