Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
docs: refine error messages (#64)
Browse files Browse the repository at this point in the history
Resolves: #62 
Signed-off-by: Sylvia Lei <lixlei@microsoft.com>
  • Loading branch information
Wwwsylvia authored May 10, 2023
1 parent 8c9764f commit a1eb424
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func Login(ctx context.Context, store Store, reg *remote.Registry, cred auth.Cre
regClone.Client = &authClient
// update credentials with the client
authClient.Credential = auth.StaticCredential(reg.Reference.Registry, cred)
// login and store credential
// validate and store the credential
if err := regClone.Ping(ctx); err != nil {
return fmt.Errorf("unable to ping the registry %s: %w", regClone.Reference.Registry, err)
return fmt.Errorf("failed to validate the credential for %s: %w", regClone.Reference.Registry, err)
}
hostname := mapStoreRegistryName(regClone.Reference.Registry)
if err := store.Put(ctx, hostname, cred); err != nil {
return fmt.Errorf("unable to store the credential for %s: %w", hostname, err)
return fmt.Errorf("failed to store the credential for %s: %w", hostname, err)
}
return nil
}
Expand All @@ -63,7 +63,7 @@ func Login(ctx context.Context, store Store, reg *remote.Registry, cred auth.Cre
func Logout(ctx context.Context, store Store, registryName string) error {
registryName = mapStoreRegistryName(registryName)
if err := store.Delete(ctx, registryName); err != nil {
return fmt.Errorf("unable to delete the credential for %s: %w", registryName, err)
return fmt.Errorf("failed to delete the credential for %s: %w", registryName, err)
}
return nil
}
Expand Down

0 comments on commit a1eb424

Please sign in to comment.