Refactor host_repo -> domain errors (#786)

* Refactor domain errors: New -> E, create helper New and Wrap
* Update host repo to use domain errors
This commit is contained in:
Louis Ruch authored and GitHub committed 2020-12-09 10:11:38 -08:00
1 parent aa4157639c
commit ec0020de90
33 files changed
+996 -374

No files matched your search

+4 -5
View File
@@ -1,9 +1,8 @@
package static
import (
"fmt"
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/errors"
)
// PublicId prefixes for the resources in the static package.
@@ -16,7 +15,7 @@ const (
func newHostCatalogId() (string, error) {
id, err := db.NewPublicId(HostCatalogPrefix)
if err != nil {
return "", fmt.Errorf("new host catalog id: %w", err)
return "", errors.Wrap(err, "static.newHostCatalogId")
}
return id, err
}
@@ -24,7 +23,7 @@ func newHostCatalogId() (string, error) {
func newHostId() (string, error) {
id, err := db.NewPublicId(HostPrefix)
if err != nil {
return "", fmt.Errorf("new host id: %w", err)
return "", errors.Wrap(err, "static.newHostId")
}
return id, err
}
@@ -32,7 +31,7 @@ func newHostId() (string, error) {
func newHostSetId() (string, error) {
id, err := db.NewPublicId(HostSetPrefix)
if err != nil {
return "", fmt.Errorf("new host set id: %w", err)
return "", errors.Wrap(err, "static.newHostSetId")
}
return id, err
}