Skip to content

Commit

Permalink
fix(k8s): fix type error when Kubernetes is not running
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed May 20, 2019
1 parent c13b034 commit 412fe57
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions garden-service/src/plugins/kubernetes/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,21 @@ export async function prepareNamespaces({ ctx, log }: GetEnvironmentStatusParams
// TODO: use API instead of kubectl (I just couldn't find which API call to make)
await kubectl.exec({ log, context: kubeContext, args: ["version"] })
} catch (err) {
// TODO: catch error properly
if (err.detail.output) {
throw new DeploymentError(
`Unable to connect to Kubernetes cluster. ` +
`Please make sure it is running, reachable and that you have the right context configured.`,
{
kubeContext,
kubectlOutput: err.detail.output,
},
)
let message = err.message
if (err.stdout) {
message += err.stdout
}
if (err.stderr) {
message += err.stderr
}
throw err
throw new DeploymentError(
`Unable to connect to Kubernetes cluster. ` +
`Please make sure it is running, reachable and that you have the right context configured.`,
{
kubeContext,
message,
},
)
}

await Bluebird.all([
Expand Down

0 comments on commit 412fe57

Please sign in to comment.