mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 20:08:02 +00:00
7295383621
* fix: translation * fix: translation * fix: translation * fix: remove unused code * fix: log err
22 lines
579 B
Go
22 lines
579 B
Go
package middleware
|
|
|
|
import (
|
|
"context"
|
|
"github.com/caos/zitadel/internal/api/grpc/errors"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
_ "github.com/caos/zitadel/internal/statik"
|
|
)
|
|
|
|
func ErrorHandler() grpc.UnaryServerInterceptor {
|
|
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
|
return toGRPCError(ctx, req, handler)
|
|
}
|
|
}
|
|
|
|
func toGRPCError(ctx context.Context, req interface{}, handler grpc.UnaryHandler) (interface{}, error) {
|
|
resp, err := handler(ctx, req)
|
|
return resp, errors.CaosToGRPCError(ctx, err)
|
|
}
|