Skip to content

Commit

Permalink
Stops k8s-helper from crashing when pod has no logs (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyjbauer authored and k8s-ci-robot committed Dec 15, 2018
1 parent 230043a commit 10c009d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/server/k8s-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ export function getPodLogs(podName: string): Promise<string> {
throw new Error('Cannot access kubernetes API');
}
return (k8sV1Client.readNamespacedPodLog(podName, namespace, 'main') as any)
.then((response: any) => response.body.toString(), (error: any) => {
throw new Error(JSON.stringify(error.body));
});
.then(
(response: any) => (response && response.body) ? response.body.toString() : '',
(error: any) => { throw new Error(JSON.stringify(error.body)); }
);
}

0 comments on commit 10c009d

Please sign in to comment.