Differentiate between server error messages and client error messages in kubectl

This commit is contained in:
Brendan Burns
2015-03-03 16:24:29 -08:00
parent 53ec66caf4
commit f505a33998
22 changed files with 142 additions and 114 deletions

View File

@@ -66,7 +66,7 @@ func (f *Factory) NewCmdDelete(out io.Writer) *cobra.Command {
Example: delete_example,
Run: func(cmd *cobra.Command, args []string) {
cmdNamespace, err := f.DefaultNamespace(cmd)
checkErr(err)
cmdutil.CheckErr(err)
mapper, typer := f.Object(cmd)
r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand(cmd)).
ContinueOnError().
@@ -77,7 +77,7 @@ func (f *Factory) NewCmdDelete(out io.Writer) *cobra.Command {
ResourceTypeOrNameArgs(false, args...).
Flatten().
Do()
checkErr(r.Err())
cmdutil.CheckErr(r.Err())
found := 0
err = r.IgnoreErrors(errors.IsNotFound).Visit(func(r *resource.Info) error {
@@ -88,7 +88,7 @@ func (f *Factory) NewCmdDelete(out io.Writer) *cobra.Command {
fmt.Fprintf(out, "%s\n", r.Name)
return nil
})
checkErr(err)
cmdutil.CheckErr(err)
if found == 0 {
fmt.Fprintf(cmd.Out(), "No resources found\n")
}