util, lang, etcd: Move the error type to our util package

We use this error in a lot of places, let's centralize it a bit.
This commit is contained in:
James Shubin
2025-02-07 17:12:28 -05:00
parent 096ef4cc66
commit ecd5a0f304
6 changed files with 59 additions and 24 deletions

View File

@@ -29,19 +29,17 @@
package interfaces
// Error is a constant error type that implements error.
type Error string
// Error fulfills the error interface of this type.
func (e Error) Error() string { return string(e) }
import (
"github.com/purpleidea/mgmt/util"
)
const (
// ErrTypeCurrentlyUnknown is returned from the Type() call on Expr if
// unification didn't run successfully and the type isn't obvious yet.
ErrTypeCurrentlyUnknown = Error("type is currently unknown")
ErrTypeCurrentlyUnknown = util.Error("type is currently unknown")
// ErrExpectedFileMissing is returned when a file that is used by an
// import is missing. This might signal the downloader, or it might
// signal a permanent error.
ErrExpectedFileMissing = Error("file is currently missing")
ErrExpectedFileMissing = util.Error("file is currently missing")
)