Merge pull request #2468 from hmrm/improve-kubectl-error-message

Improve kubectl "get" error message
This commit is contained in:
Daniel Smith 2014-11-19 15:35:53 -08:00
commit 4e29068a33

View File

@ -44,7 +44,10 @@ func ResourceFromArgsOrFile(cmd *cobra.Command, args []string, filename string,
}
version, kind, err := mapper.VersionAndKindForResource(resource)
checkErr(err)
if err != nil {
// The error returned by mapper is "no resource defined", which is a usage error
usageError(cmd, err.Error())
}
mapping, err = mapper.RESTMapping(version, kind)
checkErr(err)