From 1150a323aba765ca092fd6690125074edd7164ae Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Thu, 16 Sep 2021 16:36:30 +0200 Subject: [PATCH] Add UnsupportedFlag to the declared errors Signed-off-by: Ulysses Souza --- pkg/api/errors.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/api/errors.go b/pkg/api/errors.go index 10f628be5..4cdcd8009 100644 --- a/pkg/api/errors.go +++ b/pkg/api/errors.go @@ -42,6 +42,8 @@ var ( // ErrNotImplemented is returned when a backend doesn't implement // an action ErrNotImplemented = errors.New("not implemented") + // ErrUnsupportedFlag is returned when a backend doesn't support a flag + ErrUnsupportedFlag = errors.New("unsupported flag") // ErrCanceled is returned when the command was canceled by user ErrCanceled = errors.New("canceled") // ErrParsingFailed is returned when a string cannot be parsed @@ -71,6 +73,11 @@ func IsUnknownError(err error) bool { return errors.Is(err, ErrUnknown) } +// IsErrUnsupportedFlag returns true if the unwrapped error is ErrUnsupportedFlag +func IsErrUnsupportedFlag(err error) bool { + return errors.Is(err, ErrUnsupportedFlag) +} + // IsErrNotImplemented returns true if the unwrapped error is ErrNotImplemented func IsErrNotImplemented(err error) bool { return errors.Is(err, ErrNotImplemented)