zitadel/internal/api/grpc/server/middleware/error_interceptor.go

17 lines
480 B
Go
Raw Normal View History

2020-03-24 13:15:01 +00:00
package middleware
2020-03-23 06:01:59 +00:00
import (
"context"
"google.golang.org/grpc"
2020-03-24 13:15:01 +00:00
grpc_util "github.com/caos/zitadel/internal/api/grpc"
2020-03-23 06:01:59 +00:00
)
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)
2020-03-24 13:15:01 +00:00
return resp, grpc_util.CaosToGRPCError(err)
2020-03-23 06:01:59 +00:00
}
}