Skip to content

Commit

Permalink
Catch errors when creating REST request
Browse files Browse the repository at this point in the history
  • Loading branch information
abalabahaha committed Mar 26, 2021
1 parent 3990957 commit 6083e09
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions lib/rest/RequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,20 @@ class RequestHandler {
return;
}

const req = HTTPS.request({
method: method,
host: "discord.com",
path: this.baseURL + finalURL,
headers: headers,
agent: this.agent
});
let req;
try {
req = HTTPS.request({
method: method,
host: "discord.com",
path: this.baseURL + finalURL,
headers: headers,
agent: this.agent
});
} catch(err) {
cb();
reject(err);
return;
}

let reqError;

Expand Down

0 comments on commit 6083e09

Please sign in to comment.