Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(run-v5): log displayer eventsource events #1020

Merged
merged 6 commits into from
Sep 7, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor
  • Loading branch information
RasPhilCo committed Sep 7, 2018
commit 774267605967d44a1c9c47e59b0211c576597963
18 changes: 8 additions & 10 deletions packages/run-v5/lib/log_displayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,20 @@ function readLogsV2 (logplexURL) {
es.onerror = function (err) {
let msg = `Logs eventsource failed with: ${err.status} ${err.message}`

if (!isTail) {
if (err && (err.status || err.message)) {
reject(new Error(msg))
} else {
resolve()
}
es.close()
}

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

if (!isTail) {
resolve()
es.close()
}

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

es.onmessage = function (e) {
Expand Down