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:
Tim Möhlmann
2023-12-08 16:30:55 +02:00
committed by GitHub
parent ddbea119f1
commit f680dd934d
798 changed files with 5809 additions and 5813 deletions

View File

@@ -2,7 +2,7 @@ package model
import (
"github.com/zitadel/zitadel/internal/domain"
caos_errors "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/zerrors"
"time"
)
@@ -56,7 +56,7 @@ type ExternalIDPSearchResponse struct {
func (r *ExternalIDPSearchRequest) EnsureLimit(limit uint64) error {
if r.Limit > limit {
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-3n8fM", "Errors.Limit.ExceedsDefault")
return zerrors.ThrowInvalidArgument(nil, "SEARCH-3n8fM", "Errors.Limit.ExceedsDefault")
}
if r.Limit == 0 {
r.Limit = limit

View File

@@ -2,7 +2,7 @@ package model
import (
"github.com/zitadel/zitadel/internal/domain"
caos_errors "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/zerrors"
"time"
)
@@ -63,7 +63,7 @@ type RefreshTokenSearchResponse struct {
func (r *RefreshTokenSearchRequest) EnsureLimit(limit uint64) error {
if r.Limit > limit {
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-M0fse", "Errors.Limit.ExceedsDefault")
return zerrors.ThrowInvalidArgument(nil, "SEARCH-M0fse", "Errors.Limit.ExceedsDefault")
}
if r.Limit == 0 {
r.Limit = limit

View File

@@ -2,7 +2,7 @@ package model
import (
"github.com/zitadel/zitadel/internal/domain"
caos_errors "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/zerrors"
"time"
)
@@ -61,7 +61,7 @@ type TokenSearchResponse struct {
func (r *TokenSearchRequest) EnsureLimit(limit uint64) error {
if r.Limit > limit {
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-M0fse", "Errors.Limit.ExceedsDefault")
return zerrors.ThrowInvalidArgument(nil, "SEARCH-M0fse", "Errors.Limit.ExceedsDefault")
}
if r.Limit == 0 {
r.Limit = limit

View File

@@ -2,7 +2,7 @@ package model
import (
"github.com/zitadel/zitadel/internal/domain"
caos_errors "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/zerrors"
"time"
)
@@ -70,7 +70,7 @@ type UserMembershipSearchResponse struct {
func (r *UserMembershipSearchRequest) EnsureLimit(limit uint64) error {
if r.Limit > limit {
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-288fJ", "Errors.Limit.ExceedsDefault")
return zerrors.ThrowInvalidArgument(nil, "SEARCH-288fJ", "Errors.Limit.ExceedsDefault")
}
if r.Limit == 0 {
r.Limit = limit

View File

@@ -4,7 +4,7 @@ import (
"time"
"github.com/zitadel/zitadel/internal/domain"
caos_errors "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/zerrors"
)
type UserSessionView struct {
@@ -64,7 +64,7 @@ type UserSessionSearchResponse struct {
func (r *UserSessionSearchRequest) EnsureLimit(limit uint64) error {
if r.Limit > limit {
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-27ifs", "Errors.Limit.ExceedsDefault")
return zerrors.ThrowInvalidArgument(nil, "SEARCH-27ifs", "Errors.Limit.ExceedsDefault")
}
if r.Limit == 0 {
r.Limit = limit

View File

@@ -6,9 +6,9 @@ import (
"golang.org/x/text/language"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
iam_model "github.com/zitadel/zitadel/internal/iam/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
type UserView struct {
@@ -137,7 +137,7 @@ const (
func (r *UserSearchRequest) EnsureLimit(limit uint64) error {
if r.Limit > limit {
return errors.ThrowInvalidArgument(nil, "SEARCH-zz62F", "Errors.Limit.ExceedsDefault")
return zerrors.ThrowInvalidArgument(nil, "SEARCH-zz62F", "Errors.Limit.ExceedsDefault")
}
if r.Limit == 0 {
r.Limit = limit
@@ -247,7 +247,7 @@ func (u *UserView) HasRequiredOrgMFALevel(policy *iam_model.LoginPolicyView) boo
func (u *UserView) GetProfile() (*Profile, error) {
if u.HumanView == nil {
return nil, errors.ThrowPreconditionFailed(nil, "MODEL-WLTce", "Errors.User.NotHuman")
return nil, zerrors.ThrowPreconditionFailed(nil, "MODEL-WLTce", "Errors.User.NotHuman")
}
return &Profile{
ObjectRoot: models.ObjectRoot{
@@ -271,7 +271,7 @@ func (u *UserView) GetProfile() (*Profile, error) {
func (u *UserView) GetPhone() (*Phone, error) {
if u.HumanView == nil {
return nil, errors.ThrowPreconditionFailed(nil, "MODEL-him4a", "Errors.User.NotHuman")
return nil, zerrors.ThrowPreconditionFailed(nil, "MODEL-him4a", "Errors.User.NotHuman")
}
return &Phone{
ObjectRoot: models.ObjectRoot{
@@ -288,7 +288,7 @@ func (u *UserView) GetPhone() (*Phone, error) {
func (u *UserView) GetEmail() (*Email, error) {
if u.HumanView == nil {
return nil, errors.ThrowPreconditionFailed(nil, "MODEL-PWd6K", "Errors.User.NotHuman")
return nil, zerrors.ThrowPreconditionFailed(nil, "MODEL-PWd6K", "Errors.User.NotHuman")
}
return &Email{
ObjectRoot: models.ObjectRoot{
@@ -305,7 +305,7 @@ func (u *UserView) GetEmail() (*Email, error) {
func (u *UserView) GetAddress() (*Address, error) {
if u.HumanView == nil {
return nil, errors.ThrowPreconditionFailed(nil, "MODEL-DN61m", "Errors.User.NotHuman")
return nil, zerrors.ThrowPreconditionFailed(nil, "MODEL-DN61m", "Errors.User.NotHuman")
}
return &Address{
ObjectRoot: models.ObjectRoot{

View File

@@ -5,8 +5,8 @@ import (
"github.com/zitadel/logging"
caos_errs "github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/zerrors"
)
type Address struct {
@@ -50,7 +50,7 @@ func (a *Address) setData(event *es_models.Event) error {
a.ObjectRoot.AppendEvent(event)
if err := json.Unmarshal(event.Data, a); err != nil {
logging.Log("EVEN-clos0").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-so92s", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-so92s", "could not unmarshal event")
}
return nil
}

View File

@@ -5,8 +5,8 @@ import (
"github.com/zitadel/logging"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
"github.com/zitadel/zitadel/internal/zerrors"
)
type AuthRequest struct {
@@ -25,7 +25,7 @@ type BrowserInfo struct {
func (a *AuthRequest) SetData(event eventstore.Event) error {
if err := event.Unmarshal(a); err != nil {
logging.Log("EVEN-T5df6").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-yGmhh", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-yGmhh", "could not unmarshal event")
}
return nil
}

View File

@@ -7,8 +7,8 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/crypto"
caos_errs "github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/zerrors"
)
type Email struct {
@@ -51,7 +51,7 @@ func (a *Email) setData(event *es_models.Event) error {
a.ObjectRoot.AppendEvent(event)
if err := json.Unmarshal(event.Data, a); err != nil {
logging.Log("EVEN-dlo9s").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-sl9xw", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-sl9xw", "could not unmarshal event")
}
return nil
}
@@ -61,7 +61,7 @@ func (a *EmailCode) SetData(event *es_models.Event) error {
a.CreationDate = event.CreationDate
if err := json.Unmarshal(event.Data, a); err != nil {
logging.Log("EVEN-lo9s").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-s8uws", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-s8uws", "could not unmarshal event")
}
return nil
}

View File

@@ -5,8 +5,8 @@ import (
"github.com/zitadel/logging"
caos_errs "github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/zerrors"
)
type ExternalIDP struct {
@@ -54,7 +54,7 @@ func (pw *ExternalIDP) setData(event *es_models.Event) error {
pw.ObjectRoot.AppendEvent(event)
if err := json.Unmarshal(event.Data, pw); err != nil {
logging.Log("EVEN-Msi9d").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-A9osf", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-A9osf", "could not unmarshal event")
}
return nil
}

View File

@@ -4,10 +4,10 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/crypto"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
type OTP struct {
@@ -40,7 +40,7 @@ func (o *OTP) setData(event eventstore.Event) error {
o.ObjectRoot.AppendEvent(event)
if err := event.Unmarshal(o); err != nil {
logging.Log("EVEN-d9soe").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-lo023", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-lo023", "could not unmarshal event")
}
return nil
}
@@ -48,7 +48,7 @@ func (o *OTP) setData(event eventstore.Event) error {
func (o *OTPVerified) SetData(event eventstore.Event) error {
if err := event.Unmarshal(o); err != nil {
logging.Log("EVEN-BF421").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-GB6hj", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-GB6hj", "could not unmarshal event")
}
return nil
}

View File

@@ -6,9 +6,9 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/crypto"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/zerrors"
)
type Password struct {
@@ -51,7 +51,7 @@ func (pw *Password) setData(event eventstore.Event) error {
pw.ObjectRoot.AppendEvent(event)
if err := event.Unmarshal(pw); err != nil {
logging.Log("EVEN-dks93").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-sl9xlo2rsw", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-sl9xlo2rsw", "could not unmarshal event")
}
return nil
}
@@ -61,7 +61,7 @@ func (c *PasswordCode) SetData(event eventstore.Event) error {
c.CreationDate = event.CreatedAt()
if err := event.Unmarshal(c); err != nil {
logging.Log("EVEN-lo0y2").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-q21dr", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-q21dr", "could not unmarshal event")
}
return nil
}
@@ -69,7 +69,7 @@ func (c *PasswordCode) SetData(event eventstore.Event) error {
func (pw *PasswordChange) SetData(event eventstore.Event) error {
if err := event.Unmarshal(pw); err != nil {
logging.Log("EVEN-ADs31").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-BDd32", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-BDd32", "could not unmarshal event")
}
pw.ObjectRoot.AppendEvent(event)
return nil

View File

@@ -7,8 +7,8 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/crypto"
caos_errs "github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/zerrors"
)
type Phone struct {
@@ -56,7 +56,7 @@ func (p *Phone) setData(event *es_models.Event) error {
p.ObjectRoot.AppendEvent(event)
if err := json.Unmarshal(event.Data, p); err != nil {
logging.Log("EVEN-lco9s").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-lre56", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-lre56", "could not unmarshal event")
}
return nil
}
@@ -66,7 +66,7 @@ func (c *PhoneCode) SetData(event *es_models.Event) error {
c.CreationDate = event.CreationDate
if err := json.Unmarshal(event.Data, c); err != nil {
logging.Log("EVEN-sk8ws").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-7hdj3", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-7hdj3", "could not unmarshal event")
}
return nil
}

View File

@@ -7,9 +7,9 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/database"
caos_errs "github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
user_repo "github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/zerrors"
)
type Token struct {
@@ -49,7 +49,7 @@ func (t *Token) setData(event *es_models.Event) error {
t.ObjectRoot.AppendEvent(event)
if err := json.Unmarshal(event.Data, t); err != nil {
logging.Log("EVEN-4Fm9s").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-5Gms9", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-5Gms9", "could not unmarshal event")
}
return nil
}

View File

@@ -6,11 +6,10 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/errors"
caos_errs "github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -80,13 +79,13 @@ func (u *User) AppendEvent(event *es_models.Event) error {
return u.Machine.AppendEvent(event)
}
return errors.ThrowNotFound(nil, "MODEL-x9TaX", "Errors.UserType.Undefined")
return zerrors.ThrowNotFound(nil, "MODEL-x9TaX", "Errors.UserType.Undefined")
}
func (u *User) setData(event *es_models.Event) error {
if err := json.Unmarshal(event.Data, u); err != nil {
logging.Log("EVEN-ZDzQy").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-yGmhh", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-yGmhh", "could not unmarshal event")
}
return nil
}

View File

@@ -7,10 +7,10 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/crypto"
caos_errs "github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
type Human struct {
@@ -159,7 +159,7 @@ func (h *Human) ComputeObject() {
func (u *Human) setData(event *es_models.Event) error {
if err := json.Unmarshal(event.Data, u); err != nil {
logging.Log("EVEN-8ujgd").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-sj4jd", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-sj4jd", "could not unmarshal event")
}
return nil
}
@@ -179,7 +179,7 @@ func (c *InitUserCode) SetData(event *es_models.Event) error {
c.ObjectRoot.AppendEvent(event)
if err := json.Unmarshal(event.Data, c); err != nil {
logging.Log("EVEN-7duwe").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-lo34s", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-lo34s", "could not unmarshal event")
}
return nil
}

View File

@@ -6,9 +6,9 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
user_repo "github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/zerrors"
)
type Machine struct {
@@ -39,7 +39,7 @@ func (sa *Machine) AppendEvent(event *es_models.Event) (err error) {
func (sa *Machine) setData(event *es_models.Event) error {
if err := json.Unmarshal(event.Data, sa); err != nil {
logging.Log("EVEN-8ujgd").WithError(err).Error("could not unmarshal event data")
return errors.ThrowInternal(err, "MODEL-GwjY9", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-GwjY9", "could not unmarshal event")
}
return nil
}
@@ -69,7 +69,7 @@ func (key *MachineKey) AppendEvent(event *es_models.Event) (err error) {
case user_repo.MachineKeyAddedEventType:
err = json.Unmarshal(event.Data, key)
if err != nil {
return errors.ThrowInternal(err, "MODEL-SjI4S", "Errors.Internal")
return zerrors.ThrowInternal(err, "MODEL-SjI4S", "Errors.Internal")
}
case user_repo.MachineKeyRemovedEventType:
key.ExpirationDate = event.CreationDate

View File

@@ -3,10 +3,10 @@ package model
import (
"github.com/zitadel/logging"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
type WebAuthNToken struct {
@@ -64,7 +64,7 @@ func GetWebauthn(webauthnTokens []*WebAuthNToken, id string) (int, *WebAuthNToke
func (w *WebAuthNVerify) SetData(event eventstore.Event) error {
if err := event.Unmarshal(w); err != nil {
logging.Log("EVEN-G342rf").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-B6641", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-B6641", "could not unmarshal event")
}
return nil
}
@@ -101,7 +101,7 @@ func (u *Human) appendU2FVerifiedEvent(event eventstore.Event) error {
token.State = int32(model.MFAStateReady)
return nil
}
return caos_errs.ThrowPreconditionFailed(nil, "MODEL-4hu9s", "Errors.Users.MFA.U2F.NotExisting")
return zerrors.ThrowPreconditionFailed(nil, "MODEL-4hu9s", "Errors.Users.MFA.U2F.NotExisting")
}
func (u *Human) appendU2FChangeSignCountEvent(event eventstore.Event) error {
@@ -114,7 +114,7 @@ func (u *Human) appendU2FChangeSignCountEvent(event eventstore.Event) error {
token.setData(event)
return nil
}
return caos_errs.ThrowPreconditionFailed(nil, "MODEL-5Ms8h", "Errors.Users.MFA.U2F.NotExisting")
return zerrors.ThrowPreconditionFailed(nil, "MODEL-5Ms8h", "Errors.Users.MFA.U2F.NotExisting")
}
func (u *Human) appendU2FRemovedEvent(event eventstore.Event) error {
@@ -166,7 +166,7 @@ func (u *Human) appendPasswordlessVerifiedEvent(event eventstore.Event) error {
token.State = int32(model.MFAStateReady)
return nil
}
return caos_errs.ThrowPreconditionFailed(nil, "MODEL-mKns8", "Errors.Users.MFA.Passwordless.NotExisting")
return zerrors.ThrowPreconditionFailed(nil, "MODEL-mKns8", "Errors.Users.MFA.Passwordless.NotExisting")
}
func (u *Human) appendPasswordlessChangeSignCountEvent(event eventstore.Event) error {
@@ -182,7 +182,7 @@ func (u *Human) appendPasswordlessChangeSignCountEvent(event eventstore.Event) e
}
return nil
}
return caos_errs.ThrowPreconditionFailed(nil, "MODEL-2Mv9s", "Errors.Users.MFA.Passwordless.NotExisting")
return zerrors.ThrowPreconditionFailed(nil, "MODEL-2Mv9s", "Errors.Users.MFA.Passwordless.NotExisting")
}
func (u *Human) appendPasswordlessRemovedEvent(event eventstore.Event) error {
@@ -206,7 +206,7 @@ func (w *WebAuthNToken) setData(event eventstore.Event) error {
w.ObjectRoot.AppendEvent(event)
if err := event.Unmarshal(w); err != nil {
logging.Log("EVEN-4M9is").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-lo023", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-lo023", "could not unmarshal event")
}
return nil
}
@@ -251,7 +251,7 @@ func (w *WebAuthNLogin) setData(event eventstore.Event) error {
w.ObjectRoot.AppendEvent(event)
if err := event.Unmarshal(w); err != nil {
logging.Log("EVEN-hmSlo").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-lo023", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-lo023", "could not unmarshal event")
}
return nil
}

View File

@@ -3,10 +3,10 @@ package view
import (
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/view/repository"
"github.com/zitadel/zitadel/internal/zerrors"
"github.com/jinzhu/gorm"
caos_errs "github.com/zitadel/zitadel/internal/errors"
usr_model "github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/user/repository/view/model"
)
@@ -35,8 +35,8 @@ func ExternalIDPByExternalUserIDAndIDPConfigID(db *gorm.DB, table, externalUserI
}
query := repository.PrepareGetByQuery(table, userIDQuery, idpConfigIDQuery, instanceIDQuery, ownerRemovedQuery)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-Mso9f", "Errors.ExternalIDP.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-Mso9f", "Errors.ExternalIDP.NotFound")
}
return user, err
}
@@ -70,8 +70,8 @@ func ExternalIDPByExternalUserIDAndIDPConfigIDAndResourceOwner(db *gorm.DB, tabl
}
query := repository.PrepareGetByQuery(table, userIDQuery, idpConfigIDQuery, resourceOwnerQuery, instanceIDQuery, ownerRemovedQuery)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-Sf8sd", "Errors.ExternalIDP.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-Sf8sd", "Errors.ExternalIDP.NotFound")
}
return user, err
}

View File

@@ -6,9 +6,9 @@ import (
"github.com/zitadel/logging"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
user_repo "github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -53,7 +53,7 @@ func (r *ExternalIDPView) setRootData(event *models.Event) {
func (r *ExternalIDPView) SetData(event *models.Event) error {
if err := json.Unmarshal(event.Data, r); err != nil {
logging.Log("EVEN-48sfs").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-Hs8uf", "Could not unmarshal data")
return zerrors.ThrowInternal(err, "MODEL-Hs8uf", "Could not unmarshal data")
}
return nil
}

View File

@@ -7,11 +7,11 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/database"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
org_model "github.com/zitadel/zitadel/internal/org/model"
"github.com/zitadel/zitadel/internal/repository/user"
es_model "github.com/zitadel/zitadel/internal/user/repository/eventsourcing/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -116,7 +116,7 @@ func (u *NotifyUser) setRootData(event *models.Event) {
func (u *NotifyUser) setData(event *models.Event) error {
if err := json.Unmarshal(event.Data, u); err != nil {
logging.Log("MODEL-lso9e").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(nil, "MODEL-8iows", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-8iows", "could not unmarshal data")
}
return nil
}
@@ -125,7 +125,7 @@ func (u *NotifyUser) setPasswordData(event *models.Event) error {
password := new(es_model.Password)
if err := json.Unmarshal(event.Data, password); err != nil {
logging.Log("MODEL-dfhw6").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(nil, "MODEL-BHFD2", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-BHFD2", "could not unmarshal data")
}
u.PasswordSet = password.Secret != nil || password.EncodedHash != ""
return nil

View File

@@ -6,10 +6,10 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/database"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
user_repo "github.com/zitadel/zitadel/internal/repository/user"
usr_model "github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -122,7 +122,7 @@ func (t *RefreshTokenView) appendAddedEvent(event eventstore.Event) error {
e := new(user_repo.HumanRefreshTokenAddedEvent)
if err := event.Unmarshal(e); err != nil {
logging.Log("EVEN-Dbb31").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-Bbr42", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-Bbr42", "could not unmarshal event")
}
t.ID = e.TokenID
t.CreationDate = event.CreatedAt()
@@ -142,7 +142,7 @@ func (t *RefreshTokenView) appendRenewedEvent(event eventstore.Event) error {
e := new(user_repo.HumanRefreshTokenRenewedEvent)
if err := event.Unmarshal(e); err != nil {
logging.Log("EVEN-Vbbn2").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-Bbrn4", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-Bbrn4", "could not unmarshal event")
}
t.ID = e.TokenID
t.IdleExpiration = event.CreatedAt().Add(e.IdleExpiration)

View File

@@ -6,10 +6,10 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/database"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
user_repo "github.com/zitadel/zitadel/internal/repository/user"
usr_model "github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -133,7 +133,7 @@ func (t *TokenView) setRootData(event eventstore.Event) {
func (t *TokenView) setData(event eventstore.Event) error {
if err := event.Unmarshal(t); err != nil {
logging.Log("EVEN-3Gm9s").WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(err, "MODEL-5Gms9", "could not unmarshal event")
return zerrors.ThrowInternal(err, "MODEL-5Gms9", "could not unmarshal event")
}
return nil
}
@@ -142,7 +142,7 @@ func agentIDFromSession(event eventstore.Event) (string, error) {
session := make(map[string]interface{})
if err := event.Unmarshal(&session); err != nil {
logging.Log("EVEN-Ghgt3").WithError(err).Error("could not unmarshal event data")
return "", caos_errs.ThrowInternal(nil, "MODEL-GBf32", "could not unmarshal data")
return "", zerrors.ThrowInternal(nil, "MODEL-GBf32", "could not unmarshal data")
}
return session["userAgentID"].(string), nil
}
@@ -201,7 +201,7 @@ func eventToMap(event eventstore.Event) (map[string]interface{}, error) {
m := make(map[string]interface{})
if err := event.Unmarshal(&m); err != nil {
logging.Log("EVEN-Dbffe").WithError(err).Error("could not unmarshal event data")
return nil, caos_errs.ThrowInternal(nil, "MODEL-SDAfw", "could not unmarshal data")
return nil, zerrors.ThrowInternal(nil, "MODEL-SDAfw", "could not unmarshal data")
}
return m, nil
}

View File

@@ -9,12 +9,12 @@ import (
"github.com/zitadel/zitadel/internal/database"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
org_model "github.com/zitadel/zitadel/internal/org/model"
"github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/user/model"
es_model "github.com/zitadel/zitadel/internal/user/repository/eventsourcing/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -317,14 +317,14 @@ func (u *UserView) AppendEvent(event eventstore.Event) (err error) {
user.HumanMFAOTPAddedType:
if u.HumanView == nil {
logging.WithFields("event_sequence", event.Sequence, "aggregate_id", event.Aggregate().ID, "instance", event.Aggregate().InstanceID).Warn("event is ignored because human not exists")
return errors.ThrowInvalidArgument(nil, "MODEL-p2BXx", "event ignored: human not exists")
return zerrors.ThrowInvalidArgument(nil, "MODEL-p2BXx", "event ignored: human not exists")
}
u.OTPState = int32(model.MFAStateNotReady)
case user.UserV1MFAOTPVerifiedType,
user.HumanMFAOTPVerifiedType:
if u.HumanView == nil {
logging.WithFields("event_sequence", event.Sequence, "aggregate_id", event.Aggregate().ID, "instance", event.Aggregate().InstanceID).Warn("event is ignored because human not exists")
return errors.ThrowInvalidArgument(nil, "MODEL-o6Lcq", "event ignored: human not exists")
return zerrors.ThrowInvalidArgument(nil, "MODEL-o6Lcq", "event ignored: human not exists")
}
u.OTPState = int32(model.MFAStateReady)
u.MFAInitSkipped = time.Time{}
@@ -368,7 +368,7 @@ func (u *UserView) AppendEvent(event eventstore.Event) (err error) {
user.HumanPasswordlessInitCodeRequestedType:
if u.HumanView == nil {
logging.WithFields("event_sequence", event.Sequence, "aggregate_id", event.Aggregate().ID, "instance", event.Aggregate().InstanceID).Warn("event is ignored because human not exists")
return errors.ThrowInvalidArgument(nil, "MODEL-MbyC0", "event ignored: human not exists")
return zerrors.ThrowInvalidArgument(nil, "MODEL-MbyC0", "event ignored: human not exists")
}
if !u.PasswordSet {
u.PasswordlessInitRequired = true
@@ -388,7 +388,7 @@ func (u *UserView) setRootData(event eventstore.Event) {
func (u *UserView) setData(event eventstore.Event) error {
if err := event.Unmarshal(u); err != nil {
logging.Log("MODEL-lso9e").WithError(err).Error("could not unmarshal event data")
return errors.ThrowInternal(nil, "MODEL-8iows", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-8iows", "could not unmarshal data")
}
return nil
}
@@ -397,7 +397,7 @@ func (u *UserView) setPasswordData(event eventstore.Event) error {
password := new(es_model.Password)
if err := event.Unmarshal(password); err != nil {
logging.Log("MODEL-sdw4r").WithError(err).Error("could not unmarshal event data")
return errors.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
}
u.PasswordSet = password.Secret != nil || password.EncodedHash != ""
u.PasswordInitRequired = !u.PasswordSet
@@ -503,7 +503,7 @@ func webAuthNViewFromEvent(event eventstore.Event) (*WebAuthNView, error) {
token := new(WebAuthNView)
err := event.Unmarshal(token)
if err != nil {
return nil, errors.ThrowInternal(err, "MODEL-FSaq1", "could not unmarshal data")
return nil, zerrors.ThrowInternal(err, "MODEL-FSaq1", "could not unmarshal data")
}
return token, err
}

View File

@@ -7,7 +7,6 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/database"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
iam_es_model "github.com/zitadel/zitadel/internal/iam/repository/eventsourcing/model"
org_es_model "github.com/zitadel/zitadel/internal/org/repository/eventsourcing/model"
@@ -16,6 +15,7 @@ import (
"github.com/zitadel/zitadel/internal/repository/org"
"github.com/zitadel/zitadel/internal/repository/project"
"github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -93,7 +93,7 @@ func (u *UserMembershipView) setIamMemberData(event *models.Event) error {
member := new(iam_es_model.IAMMember)
if err := json.Unmarshal(event.Data, member); err != nil {
logging.New().WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
}
u.UserID = member.UserID
u.Roles = member.Roles
@@ -104,7 +104,7 @@ func (u *UserMembershipView) setOrgMemberData(event *models.Event) error {
member := new(org_es_model.OrgMember)
if err := json.Unmarshal(event.Data, member); err != nil {
logging.New().WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
}
u.UserID = member.UserID
u.Roles = member.Roles
@@ -115,7 +115,7 @@ func (u *UserMembershipView) setProjectMemberData(event *models.Event) error {
member := new(proj_es_model.ProjectMember)
if err := json.Unmarshal(event.Data, member); err != nil {
logging.New().WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
}
u.UserID = member.UserID
u.Roles = member.Roles
@@ -126,7 +126,7 @@ func (u *UserMembershipView) setProjectGrantMemberData(event *models.Event) erro
member := new(proj_es_model.ProjectGrantMember)
if err := json.Unmarshal(event.Data, member); err != nil {
logging.New().WithError(err).Error("could not unmarshal event data")
return caos_errs.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
return zerrors.ThrowInternal(nil, "MODEL-6jhsw", "could not unmarshal data")
}
u.UserID = member.UserID
u.ObjectID = member.GrantID

View File

@@ -6,11 +6,11 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/domain"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
"github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/user/model"
es_model "github.com/zitadel/zitadel/internal/user/repository/eventsourcing/model"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
@@ -49,7 +49,7 @@ func UserSessionFromEvent(event eventstore.Event) (*UserSessionView, error) {
v := new(UserSessionView)
if err := event.Unmarshal(v); err != nil {
logging.Log("EVEN-lso9e").WithError(err).Error("could not unmarshal event data")
return nil, caos_errs.ThrowInternal(nil, "MODEL-sd325", "could not unmarshal data")
return nil, zerrors.ThrowInternal(nil, "MODEL-sd325", "could not unmarshal data")
}
return v, nil
}
@@ -212,7 +212,7 @@ func avatarKeyFromEvent(event eventstore.Event) (string, error) {
data := make(map[string]string)
if err := event.Unmarshal(&data); err != nil {
logging.Log("EVEN-Sfew2").WithError(err).Error("could not unmarshal event data")
return "", caos_errs.ThrowInternal(err, "MODEL-SFw2q", "could not unmarshal event")
return "", zerrors.ThrowInternal(err, "MODEL-SFw2q", "could not unmarshal event")
}
return data["storeKey"], nil
}

View File

@@ -4,10 +4,10 @@ import (
"github.com/jinzhu/gorm"
"github.com/zitadel/zitadel/internal/domain"
caos_errs "github.com/zitadel/zitadel/internal/errors"
usr_model "github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/user/repository/view/model"
"github.com/zitadel/zitadel/internal/view/repository"
"github.com/zitadel/zitadel/internal/zerrors"
)
func NotifyUserByID(db *gorm.DB, table, userID, instanceID string) (*model.NotifyUser, error) {
@@ -17,8 +17,8 @@ func NotifyUserByID(db *gorm.DB, table, userID, instanceID string) (*model.Notif
model.NotifyUserSearchQuery{Key: usr_model.NotifyUserSearchKeyInstanceID, Method: domain.SearchMethodEquals, Value: instanceID},
)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-Gad31", "Errors.User.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-Gad31", "Errors.User.NotFound")
}
return user, err
}

View File

@@ -1,14 +1,14 @@
package view
import (
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
"github.com/zitadel/zitadel/internal/repository/user"
"github.com/zitadel/zitadel/internal/zerrors"
)
func UserByIDQuery(id, instanceID string, sequence uint64, eventTypes []eventstore.EventType) (*eventstore.SearchQueryBuilder, error) {
if id == "" {
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-d8isw", "Errors.User.UserIDMissing")
return nil, zerrors.ThrowPreconditionFailed(nil, "EVENT-d8isw", "Errors.User.UserIDMissing")
}
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
AwaitOpenTransactions().

View File

@@ -4,10 +4,10 @@ import (
"github.com/jinzhu/gorm"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/user/model"
usr_model "github.com/zitadel/zitadel/internal/user/repository/view/model"
"github.com/zitadel/zitadel/internal/view/repository"
"github.com/zitadel/zitadel/internal/zerrors"
)
func RefreshTokenByID(db *gorm.DB, table, tokenID, instanceID string) (*usr_model.RefreshTokenView, error) {
@@ -17,8 +17,8 @@ func RefreshTokenByID(db *gorm.DB, table, tokenID, instanceID string) (*usr_mode
&usr_model.RefreshTokenSearchQuery{Key: model.RefreshTokenSearchKeyInstanceID, Method: domain.SearchMethodEquals, Value: instanceID},
)
err := query(db, token)
if errors.IsNotFound(err) {
return nil, errors.ThrowNotFound(nil, "VIEW-6ub3p", "Errors.RefreshToken.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-6ub3p", "Errors.RefreshToken.NotFound")
}
return token, err
}

View File

@@ -4,10 +4,10 @@ import (
"github.com/jinzhu/gorm"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/user/model"
usr_model "github.com/zitadel/zitadel/internal/user/repository/view/model"
"github.com/zitadel/zitadel/internal/view/repository"
"github.com/zitadel/zitadel/internal/zerrors"
)
func TokenByIDs(db *gorm.DB, table, tokenID, userID, instanceID string) (*usr_model.TokenView, error) {
@@ -18,8 +18,8 @@ func TokenByIDs(db *gorm.DB, table, tokenID, userID, instanceID string) (*usr_mo
&usr_model.TokenSearchQuery{Key: model.TokenSearchKeyInstanceID, Method: domain.SearchMethodEquals, Value: instanceID},
)
err := query(db, token)
if errors.IsNotFound(err) {
return nil, errors.ThrowNotFound(nil, "VIEW-6ub3p", "Errors.Token.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-6ub3p", "Errors.Token.NotFound")
}
return token, err
}

View File

@@ -4,10 +4,10 @@ import (
"github.com/jinzhu/gorm"
"github.com/zitadel/zitadel/internal/domain"
caos_errs "github.com/zitadel/zitadel/internal/errors"
usr_model "github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/user/repository/view/model"
"github.com/zitadel/zitadel/internal/view/repository"
"github.com/zitadel/zitadel/internal/zerrors"
)
func UserSessionByIDs(db *gorm.DB, table, agentID, userID, instanceID string) (*model.UserSessionView, error) {
@@ -29,8 +29,8 @@ func UserSessionByIDs(db *gorm.DB, table, agentID, userID, instanceID string) (*
}
query := repository.PrepareGetByQuery(table, userAgentQuery, userQuery, instanceIDQuery)
err := query(db, userSession)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-NGBs1", "Errors.UserSession.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-NGBs1", "Errors.UserSession.NotFound")
}
return userSession, err
}

View File

@@ -1,14 +1,13 @@
package view
import (
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/view/repository"
"github.com/jinzhu/gorm"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/domain"
usr_model "github.com/zitadel/zitadel/internal/user/model"
"github.com/zitadel/zitadel/internal/user/repository/view/model"
"github.com/zitadel/zitadel/internal/view/repository"
"github.com/zitadel/zitadel/internal/zerrors"
)
func UserByID(db *gorm.DB, table, userID, instanceID string) (*model.UserView, error) {
@@ -30,8 +29,8 @@ func UserByID(db *gorm.DB, table, userID, instanceID string) (*model.UserView, e
}
query := repository.PrepareGetByQuery(table, userIDQuery, instanceIDQuery, ownerRemovedQuery)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-sj8Sw", "Errors.User.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-sj8Sw", "Errors.User.NotFound")
}
user.SetEmptyUserType()
return user, err
@@ -56,8 +55,8 @@ func UserByUserName(db *gorm.DB, table, userName, instanceID string) (*model.Use
}
query := repository.PrepareGetByQuery(table, userNameQuery, instanceIDQuery, ownerRemovedQuery)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-Lso9s", "Errors.User.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-Lso9s", "Errors.User.NotFound")
}
user.SetEmptyUserType()
return user, err
@@ -82,8 +81,8 @@ func UserByLoginName(db *gorm.DB, table, loginName, instanceID string) (*model.U
}
query := repository.PrepareGetByQuery(table, loginNameQuery, instanceIDQuery, ownerRemovedQuery)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-AD4qs", "Errors.User.NotFound")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-AD4qs", "Errors.User.NotFound")
}
user.SetEmptyUserType()
return user, err
@@ -113,8 +112,8 @@ func UserByLoginNameAndResourceOwner(db *gorm.DB, table, loginName, resourceOwne
}
query := repository.PrepareGetByQuery(table, loginNameQuery, resourceOwnerQuery, instanceIDQuery, ownerRemovedQuery)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-AD4qs", "Errors.User.NotFoundOnOrg")
if zerrors.IsNotFound(err) {
return nil, zerrors.ThrowNotFound(nil, "VIEW-AD4qs", "Errors.User.NotFoundOnOrg")
}
user.SetEmptyUserType()
return user, err