mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +00:00
fix: proper error message when user (and other objects) not found (#337)
* fix: proper error message when user not found by loginname * add more not found and fix some typos
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
org_model "github.com/caos/zitadel/internal/org/model"
|
||||
"github.com/caos/zitadel/internal/org/repository/view/model"
|
||||
@@ -14,6 +15,9 @@ func OrgDomainByOrgIDAndDomain(db *gorm.DB, table, orgID, domain string) (*model
|
||||
domainQuery := &model.OrgDomainSearchQuery{Key: org_model.OrgDomainSearchKeyDomain, Value: domain, Method: global_model.SearchMethodEquals}
|
||||
query := repository.PrepareGetByQuery(table, orgIDQuery, domainQuery)
|
||||
err := query(db, domainView)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "VIEW-Gqwfq", "Errors.Org.DomainNotOnOrg")
|
||||
}
|
||||
return domainView, err
|
||||
}
|
||||
|
||||
@@ -23,6 +27,9 @@ func VerifiedOrgDomain(db *gorm.DB, table, domain string) (*model.OrgDomainView,
|
||||
verifiedQuery := &model.OrgDomainSearchQuery{Key: org_model.OrgDomainSearchKeyVerified, Value: true, Method: global_model.SearchMethodEquals}
|
||||
query := repository.PrepareGetByQuery(table, domainQuery, verifiedQuery)
|
||||
err := query(db, domainView)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "VIEW-Tew2q", "Errors.Org.DomainNotFound")
|
||||
}
|
||||
return domainView, err
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
org_model "github.com/caos/zitadel/internal/org/model"
|
||||
"github.com/caos/zitadel/internal/org/repository/view/model"
|
||||
@@ -15,6 +16,9 @@ func OrgMemberByIDs(db *gorm.DB, table, orgID, userID string) (*model.OrgMemberV
|
||||
userIDQuery := &model.OrgMemberSearchQuery{Key: org_model.OrgMemberSearchKeyUserID, Value: userID, Method: global_model.SearchMethodEquals}
|
||||
query := repository.PrepareGetByQuery(table, orgIDQuery, userIDQuery)
|
||||
err := query(db, member)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "VIEW-DG1qh", "Errors.Org.MemberNotFound")
|
||||
}
|
||||
return member, err
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
org_model "github.com/caos/zitadel/internal/org/model"
|
||||
"github.com/caos/zitadel/internal/org/repository/view/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
@@ -11,6 +12,9 @@ func OrgByID(db *gorm.DB, table, orgID string) (*model.OrgView, error) {
|
||||
org := new(model.OrgView)
|
||||
query := repository.PrepareGetByKey(table, model.OrgSearchKey(org_model.OrgSearchKeyOrgID), orgID)
|
||||
err := query(db, org)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "VIEW-GEwea", "Errors.Org.NotFound")
|
||||
}
|
||||
return org, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user