Skip to content

Commit

Permalink
fix(plugins/plugin-kubectl): k delete via API does not properly handl…
Browse files Browse the repository at this point in the history
…e proxy errors

we are returning the error, rather than throwing it

part of #8004
  • Loading branch information
starpit committed Sep 15, 2021
1 parent dcf2131 commit e5106e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/plugin-kubectl/src/controller/client/direct/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ export default async function deleteDirect(args: Arguments<KubeOptions>, _kind?:
// then dissect it into errors and non-errors
const { errors, ok } = await handleErrors(responses, formatUrl, kind, args.REPL)
if (ok.length === 0) {
// all 404 errors? then tell the user about them (no need to re-invoke the CLI)
if (errors.length > 0 && errors.every(is404)) {
return errors.map(_ => _.message).join('\n')
// all 404 errors? then tell the user about them (no need to re-invoke the CLI)
debug('throwing delete errors from the API', errors)
throw new Error(errors.map(_ => _.message).join('\n'))
}
// otherwise: intentional fall-through, returning void; let
// kubectl CLI handle the errors for now
Expand Down

0 comments on commit e5106e3

Please sign in to comment.