Commit 04d8ae4e authored by vaikas-google's avatar vaikas-google

Merge pull request #229 from jackgr/master

Replace cross package panic with error return.
parents 92710a33 f52ea81f
...@@ -168,6 +168,7 @@ type githubRegistryProvider struct { ...@@ -168,6 +168,7 @@ type githubRegistryProvider struct {
// NewGithubRegistryProvider creates a GithubRegistryProvider. // NewGithubRegistryProvider creates a GithubRegistryProvider.
func NewGithubRegistryProvider(cp common.CredentialProvider) GithubRegistryProvider { func NewGithubRegistryProvider(cp common.CredentialProvider) GithubRegistryProvider {
if cp == nil { if cp == nil {
// TODO: replace this panic with an error return.
panic(fmt.Errorf("no credential provider")) panic(fmt.Errorf("no credential provider"))
} }
return &githubRegistryProvider{cp: cp} return &githubRegistryProvider{cp: cp}
...@@ -239,6 +240,7 @@ type gcsRegistryProvider struct { ...@@ -239,6 +240,7 @@ type gcsRegistryProvider struct {
// NewGCSRegistryProvider creates a GCSRegistryProvider. // NewGCSRegistryProvider creates a GCSRegistryProvider.
func NewGCSRegistryProvider(cp common.CredentialProvider) GCSRegistryProvider { func NewGCSRegistryProvider(cp common.CredentialProvider) GCSRegistryProvider {
if cp == nil { if cp == nil {
// TODO: replace this panic with an error return.
panic(fmt.Errorf("no credential provider")) panic(fmt.Errorf("no credential provider"))
} }
return &gcsRegistryProvider{cp: cp} return &gcsRegistryProvider{cp: cp}
...@@ -350,7 +352,7 @@ func ShortTypeToDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, ...@@ -350,7 +352,7 @@ func ShortTypeToDownloadURLs(rp RegistryProvider, t string) ([]string, Registry,
} }
if r == nil { 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]) tt, err := NewType(m[3], m[4], m[5])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment