From f52ea81f7b630ba1933beb527cce2335681684b0 Mon Sep 17 00:00:00 2001 From: jackgr Date: Sat, 6 Feb 2016 14:16:33 -0800 Subject: [PATCH] Replace cross package panic with error return. --- registry/registryprovider.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registry/registryprovider.go b/registry/registryprovider.go index a62391a21..d722f4b4c 100644 --- a/registry/registryprovider.go +++ b/registry/registryprovider.go @@ -168,6 +168,7 @@ type githubRegistryProvider struct { // NewGithubRegistryProvider creates a GithubRegistryProvider. func NewGithubRegistryProvider(cp common.CredentialProvider) GithubRegistryProvider { if cp == nil { + // TODO: replace this panic with an error return. panic(fmt.Errorf("no credential provider")) } return &githubRegistryProvider{cp: cp} @@ -239,6 +240,7 @@ type gcsRegistryProvider struct { // NewGCSRegistryProvider creates a GCSRegistryProvider. func NewGCSRegistryProvider(cp common.CredentialProvider) GCSRegistryProvider { if cp == nil { + // TODO: replace this panic with an error return. panic(fmt.Errorf("no credential provider")) } return &gcsRegistryProvider{cp: cp} @@ -350,7 +352,7 @@ func ShortTypeToDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, } if r == nil { - panic(fmt.Errorf("cannot get github registry for %s", t)) + return nil, nil, fmt.Errorf("cannot get github registry for %s", t) } tt, err := NewType(m[3], m[4], m[5])