mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-12 14:53:41 +00:00
fix: message key in error detail (#503)
This commit is contained in:
parent
117a0d7b19
commit
520cc161d7
@ -2,16 +2,12 @@ package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/logging"
|
||||
|
||||
"github.com/caos/zitadel/pkg/grpc/message"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/i18n"
|
||||
"github.com/caos/zitadel/pkg/grpc/message"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func CaosToGRPCError(ctx context.Context, err error, translator *i18n.Translator) error {
|
||||
@ -25,11 +21,12 @@ func CaosToGRPCError(ctx context.Context, err error, translator *i18n.Translator
|
||||
msg := key
|
||||
if translator != nil {
|
||||
msg = translator.LocalizeFromCtx(ctx, key, nil)
|
||||
msg += " (" + id + ")"
|
||||
}
|
||||
s, err := status.New(code, key).WithDetails(&message.ErrorDetail{Id: id, Message: msg})
|
||||
s, err := status.New(code, msg).WithDetails(&message.ErrorDetail{Id: id, Message: key})
|
||||
if err != nil {
|
||||
logging.Log("GRPC-gIeRw").WithError(err).Debug("unable to add detail")
|
||||
return status.New(code, key).Err()
|
||||
return status.New(code, msg).Err()
|
||||
}
|
||||
|
||||
return s.Err()
|
||||
|
Loading…
x
Reference in New Issue
Block a user