mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:37:31 +00:00
refactor: rename package errors to zerrors (#7039)
* chore: rename package errors to zerrors * rename package errors to gerrors * fix error related linting issues * fix zitadel error assertion * fix gosimple linting issues * fix deprecated linting issues * resolve gci linting issues * fix import structure --------- Co-authored-by: Elio Bischof <elio@zitadel.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
_ "embed"
|
||||
errs "errors"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -14,8 +14,8 @@ import (
|
||||
"github.com/jackc/pgconn"
|
||||
"github.com/zitadel/logging"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
func (es *Eventstore) Push(ctx context.Context, commands ...eventstore.Command) (events []eventstore.Event, err error) {
|
||||
@@ -77,16 +77,16 @@ func insertEvents(ctx context.Context, tx *sql.Tx, sequences []*latestSequence,
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
pgErr := new(pgconn.PgError)
|
||||
if errs.As(err, &pgErr) {
|
||||
if errors.As(err, &pgErr) {
|
||||
// Check if push tries to write an event just written
|
||||
// by another transaction
|
||||
if pgErr.Code == "40001" {
|
||||
// TODO: @livio-a should we return the parent or not?
|
||||
return nil, errors.ThrowInvalidArgument(err, "V3-p5xAn", "Errors.AlreadyExists")
|
||||
return nil, zerrors.ThrowInvalidArgument(err, "V3-p5xAn", "Errors.AlreadyExists")
|
||||
}
|
||||
}
|
||||
logging.WithError(rows.Err()).Warn("failed to push events")
|
||||
return nil, errors.ThrowInternal(err, "V3-VGnZY", "Errors.Internal")
|
||||
return nil, zerrors.ThrowInternal(err, "V3-VGnZY", "Errors.Internal")
|
||||
}
|
||||
|
||||
return events, nil
|
||||
@@ -132,7 +132,7 @@ func mapCommands(commands []eventstore.Command, sequences []*latestSequence) (ev
|
||||
|
||||
revision, err := strconv.Atoi(strings.TrimPrefix(string(events[i].(*event).aggregate.Version), "v"))
|
||||
if err != nil {
|
||||
return nil, nil, nil, errors.ThrowInternal(err, "V3-JoZEp", "Errors.Internal")
|
||||
return nil, nil, nil, zerrors.ThrowInternal(err, "V3-JoZEp", "Errors.Internal")
|
||||
}
|
||||
args = append(args,
|
||||
events[i].(*event).aggregate.InstanceID,
|
||||
|
Reference in New Issue
Block a user