Expose ErrResourceOwnerNotFound in err package (#3214)
<!-- PR description--> Expose `ErrResourceOwnerNotFound` in `err` package to make for neat error handling #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #COR-74 #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
83e6803e3a
commit
51809cf6eb
@ -13,18 +13,20 @@ import (
|
|||||||
type errEnum string
|
type errEnum string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RepoAlreadyExists errEnum = "repository-already-exists"
|
RepoAlreadyExists errEnum = "repository-already-exists"
|
||||||
BackupNotFound errEnum = "backup-not-found"
|
BackupNotFound errEnum = "backup-not-found"
|
||||||
ServiceNotEnabled errEnum = "service-not-enabled"
|
ServiceNotEnabled errEnum = "service-not-enabled"
|
||||||
|
ResourceOwnerNotFound errEnum = "resource-owner-not-found"
|
||||||
)
|
)
|
||||||
|
|
||||||
// map of enums to errors. We might want to re-use an enum for multiple
|
// map of enums to errors. We might want to re-use an enum for multiple
|
||||||
// internal errors (ex: "ServiceNotEnabled" may exist in both graph and
|
// internal errors (ex: "ServiceNotEnabled" may exist in both graph and
|
||||||
// non-graph producers).
|
// non-graph producers).
|
||||||
var internalToExternal = map[errEnum][]error{
|
var internalToExternal = map[errEnum][]error{
|
||||||
RepoAlreadyExists: {repository.ErrorRepoAlreadyExists},
|
RepoAlreadyExists: {repository.ErrorRepoAlreadyExists},
|
||||||
BackupNotFound: {repository.ErrorBackupNotFound},
|
BackupNotFound: {repository.ErrorBackupNotFound},
|
||||||
ServiceNotEnabled: {graph.ErrServiceNotEnabled},
|
ServiceNotEnabled: {graph.ErrServiceNotEnabled},
|
||||||
|
ResourceOwnerNotFound: {graph.ErrResourceOwnerNotFound},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is checks if the provided error contains an internal error that matches
|
// Is checks if the provided error contains an internal error that matches
|
||||||
|
|||||||
@ -27,6 +27,7 @@ func (suite *ErrUnitSuite) TestIs() {
|
|||||||
{RepoAlreadyExists, repository.ErrorRepoAlreadyExists},
|
{RepoAlreadyExists, repository.ErrorRepoAlreadyExists},
|
||||||
{BackupNotFound, repository.ErrorBackupNotFound},
|
{BackupNotFound, repository.ErrorBackupNotFound},
|
||||||
{ServiceNotEnabled, graph.ErrServiceNotEnabled},
|
{ServiceNotEnabled, graph.ErrServiceNotEnabled},
|
||||||
|
{ResourceOwnerNotFound, graph.ErrResourceOwnerNotFound},
|
||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.Run(string(test.is), func() {
|
suite.Run(string(test.is), func() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user