-
Notifications
You must be signed in to change notification settings - Fork 317
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
Fixes for Error Handling #231
base: master
Are you sure you want to change the base?
Changes from all commits
7912a20
b343bb4
dc3b237
502edd9
ba157db
7a07a54
1125fdd
ef53abc
6d82dc8
788accd
8709dfa
d44c80e
9bc5c7b
c03e431
8c9b3e2
e6eefe5
72b76f7
38799e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,10 +33,7 @@ function validate(opts) { | |
} | ||
|
||
function isRetriable(err) { | ||
if (!err.response) { | ||
return false; | ||
} | ||
const statusCode = err.response.statusCode; | ||
const statusCode = err.response ? err.response.statusCode : err.body? err.body.status_code : 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the situation in which there was no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I can tell, this doesn't come from changes to the NgrokClient. This change was made because I was receiving errors in the error handling that should have gone through the retry logic but didn't because of this problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that one of the unit tests dealing with paid plans is broken now, it looks like this needs further investigation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem occurs when someone has a paid plan and it's in use on another machine. In other words, a tunnel cannot be created because only one tunnel is allowed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd put this in a separate PR personally |
||
const body = err.body; | ||
const notReady500 = statusCode === 500 && /panic/.test(body); | ||
const notReady502 = | ||
|
@@ -47,7 +44,7 @@ function isRetriable(err) { | |
statusCode === 503 && | ||
body.details && | ||
body.details.err === | ||
"a successful ngrok tunnel session has not yet been established"; | ||
"a successful ngrok tunnel session has not yet been established"; | ||
return notReady500 || notReady502 || notReady503; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of things here:
try ... catch
we don't need to create the variable at the start.Could we do something like this: