-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
credentials: implement errdefs types for typed errors
This allows for checking the error-type returned to be matched with the errdefs utilities. Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,11 @@ func (errCredentialsNotFound) Error() string { | |
return errCredentialsNotFoundMessage | ||
} | ||
|
||
// NotFound implements the [ErrNotFound][errdefs.ErrNotFound] interface. | ||
// | ||
// [errdefs.ErrNotFound]: https://pkg.go.dev/github.com/docker/[email protected]+incompatible/errdefs#ErrNotFound | ||
func (errCredentialsNotFound) NotFound() {} | ||
|
||
// NewErrCredentialsNotFound creates a new error | ||
// for when the credentials are not in the store. | ||
func NewErrCredentialsNotFound() error { | ||
|
@@ -55,6 +60,12 @@ func (errCredentialsMissingServerURL) Error() string { | |
return errCredentialsMissingServerURLMessage | ||
} | ||
|
||
// InvalidParameter implements the [ErrInvalidParameter][errdefs.ErrInvalidParameter] | ||
// interface. | ||
// | ||
// [errdefs.ErrInvalidParameter]: https://pkg.go.dev/github.com/docker/[email protected]+incompatible/errdefs#ErrInvalidParameter | ||
func (errCredentialsMissingServerURL) InvalidParameter() {} | ||
|
||
// errCredentialsMissingUsername represents an error raised | ||
// when the credentials object has no username or when no | ||
// username is provided to a credentials operation requiring | ||
|
@@ -65,6 +76,12 @@ func (errCredentialsMissingUsername) Error() string { | |
return errCredentialsMissingUsernameMessage | ||
} | ||
|
||
// InvalidParameter implements the [ErrInvalidParameter][errdefs.ErrInvalidParameter] | ||
// interface. | ||
// | ||
// [errdefs.ErrInvalidParameter]: https://pkg.go.dev/github.com/docker/[email protected]+incompatible/errdefs#ErrInvalidParameter | ||
func (errCredentialsMissingUsername) InvalidParameter() {} | ||
|
||
// NewErrCredentialsMissingServerURL creates a new error for | ||
// errCredentialsMissingServerURL. | ||
func NewErrCredentialsMissingServerURL() error { | ||
|