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:
Livio Amstutz
2020-07-06 13:18:10 +02:00
committed by GitHub
parent b7298bed1e
commit 26634505ba
17 changed files with 90 additions and 5 deletions

View File

@@ -39,6 +39,9 @@ func UserByLoginName(db *gorm.DB, table, loginName string) (*model.UserView, err
}
query := repository.PrepareGetByQuery(table, loginNameQuery)
err := query(db, user)
if caos_errs.IsNotFound(err) {
return nil, caos_errs.ThrowNotFound(nil, "VIEW-AD4qs", "Errors.User.NotFound")
}
return user, err
}