Skip to content

Commit

Permalink
Human friendly errror output (#85)
Browse files Browse the repository at this point in the history
Enhance error output
  • Loading branch information
shizhMSFT authored Apr 19, 2019
1 parent 4223f0b commit c2faeab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/oras/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/deislabs/oras/pkg/oras"

"github.com/containerd/containerd/images"
"github.com/containerd/containerd/reference"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
Expand All @@ -34,7 +35,7 @@ type pullOptions struct {
func pullCmd() *cobra.Command {
var opts pullOptions
cmd := &cobra.Command{
Use: "pull name[:tag|@digest]",
Use: "pull <name:tag|name@digest>",
Short: "Pull files from remote registry",
Long: `Pull files from remote registry
Expand Down Expand Up @@ -92,6 +93,9 @@ func runPull(opts pullOptions) error {
oras.WithPullCallbackHandler(pullStatusTrack()),
)
if err != nil {
if err == reference.ErrObjectRequired {
return fmt.Errorf("image reference format is invalid. Please specify <name:tag|name@digest>")
}
return err
}
fmt.Println("Pulled", opts.targetRef)
Expand Down

0 comments on commit c2faeab

Please sign in to comment.