-
Notifications
You must be signed in to change notification settings - Fork 315
Description
Also, there is a problem in the client code:
Here:
async request(method, path, options = {}) {
try {
...
} catch (error) {
let clientError;
try {
const response = JSON.parse(error.response.body);
clientError = new NgrokClientError(
response.msg,
error.response,
response
);
} catch (e) {
clientError = new NgrokClientError(
error.response.body,
error.response,
error.response.body
);
}
throw clientError;
}
}
Some errors don't have a response or a response.body and you "typeerror cannot read property 'body' of undefined", probably from the second catch... It would be better to just return the error. When doing so, you get a much more useful message that helped to debug the above missing await (ngrok is not yet ready to start tunnels):
in client.js
async request(method, path, options = {}) {
try {
...
} catch (error) {
let clientError;
try {
const response = JSON.parse(error.response);
clientError = new NgrokClientError(
response.msg,
error.response,
response
);
}
jfbaraky, gonzaloriestra and justin-gamble
Metadata
Metadata
Assignees
Labels
No labels