util: add New* funcs for ErrKeyNotFound & ErrPoolNotFound types

These types have private fields but we need to construct them outside of
the util package. Add New* methods for both.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-05-21 15:58:08 -04:00 committed by mergify[bot]
parent 1a1ad11f57
commit f3192bd1b3

View File

@ -22,6 +22,10 @@ type ErrKeyNotFound struct {
err error
}
func NewErrKeyNotFound(keyName string, err error) ErrKeyNotFound {
return ErrKeyNotFound{keyName, err}
}
func (e ErrKeyNotFound) Error() string {
return e.err.Error()
}
@ -71,3 +75,7 @@ type ErrPoolNotFound struct {
func (e ErrPoolNotFound) Error() string {
return e.Err.Error()
}
func NewErrPoolNotFound(pool string, err error) ErrPoolNotFound {
return ErrPoolNotFound{pool, err}
}