Skip to content

Commit

Permalink
Merge pull request #804 from brendandburns/examples
Browse files Browse the repository at this point in the history
Improve error handling in the follow logs example.
  • Loading branch information
k8s-ci-robot authored May 23, 2022
2 parents 9b27b68 + 55f078c commit 426faac
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions examples/follow-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ logStream.on('data', (chunk) => {
process.stdout.write(chunk);
});

log.log('default', 'pod1', 'container1', logStream, {follow: true, tailLines: 50, pretty: false, timestamps: false})
.catch(err => {console.log(err)})
log.log('default', 'pod1', 'container', logStream, {follow: true, tailLines: 50, pretty: false, timestamps: false})
.catch(err => {
console.log(err);
process.exit(1);
})
.then(req => {
// disconnects after 5 seconds
setTimeout(function(){
req.abort();
}, 5000);
if (req) {
setTimeout(function(){
req.abort();
}, 5000);
}
});

0 comments on commit 426faac

Please sign in to comment.