Skip to content

Commit

Permalink
fix(run-v5): log displayer eventsource events (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo authored Sep 7, 2018
1 parent e194808 commit 9833c4e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/run-v5/lib/log_displayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,20 @@ function readLogsV2 (logplexURL) {
})

es.onerror = function (err) {
if (!isTail) {
resolve()
if (err && (err.status || err.message)) {
const msg = (isTail && (err.status === 404 || err.status === 403)) ?
'Log stream timed out. Please try again.' :
`Logs eventsource failed with: ${err.status} ${err.message}`
reject(msg)
es.close()
}

if (err && (err.status === 404 || err.status === 403)) {
reject(new Error('Log stream timed out. Please try again.'))
if (!isTail) {
resolve()
es.close()
}

// should only land here if --tail and no error status or message
}

es.onmessage = function (e) {
Expand Down

0 comments on commit 9833c4e

Please sign in to comment.