Merge pull request #8628 from ulyssessouza/add-unsupportedflagerror

Add UnsupportedFlag to the declared errors
This commit is contained in:
Ulysses Souza 2021-09-16 17:08:57 +02:00 committed by GitHub
commit 15cd034485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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)