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

+17
View File
@@ -89,3 +89,20 @@ func IsMissingTableError(err error) bool {
}
return false
}
// IsNotFoundError returns a boolean indicating whether the error is known to
// report a not found violation.
func IsNotFoundError(err error) bool {
if err == nil {
return false
}
var domainErr *Err
if errors.As(err, &domainErr) {
if domainErr.Code == RecordNotFound {
return true
}
}
return false
}