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

@@ -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