-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8d5d4e
commit ef2f5ec
Showing
3 changed files
with
32 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package kubernetes | ||
|
||
import ( | ||
"github.com/cloudogu/k8s-blueprint-operator/pkg/domainservice" | ||
liberrors "github.com/cloudogu/k8s-registry-lib/errors" | ||
) | ||
|
||
func mapToBlueprintError(err error) error { | ||
if err != nil { | ||
if liberrors.IsNotFoundError(err) { | ||
return domainservice.NewNotFoundError(err, "could not find config. Check if your ecosystem is ready for operation") | ||
} else if liberrors.IsConflictError(err) { | ||
return domainservice.NewInternalError(err, "could not update config due to conflicting changes") | ||
} else if liberrors.IsConnectionError(err) { | ||
return domainservice.NewInternalError(err, "could not load/update config due to connection problems") | ||
} else if liberrors.IsAlreadyExistsError(err) { | ||
return domainservice.NewInternalError(err, "could not create config as it already exists") | ||
} else { | ||
// GenericError and fallback if even that would not match the error | ||
return domainservice.NewInternalError(err, "could not load/update config due to an unknown problem") | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters