mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
chore: consistency/prettier (#3852)
* chore: consistency/prettier * chore: rebase * chore: rebase * chore: include typings * fix: include typings file in prettier lint-staged
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
const DiscordAPIError = require('./DiscordAPIError');
|
||||
const HTTPError = require('./HTTPError');
|
||||
const {
|
||||
Events: { RATE_LIMIT },
|
||||
browser,
|
||||
} = require('../util/Constants');
|
||||
const Util = require('../util/Util');
|
||||
const { Events: { RATE_LIMIT }, browser } = require('../util/Constants');
|
||||
|
||||
function parseResponse(res) {
|
||||
if (res.headers.get('content-type').startsWith('application/json')) return res.json();
|
||||
@@ -52,7 +55,6 @@ class RequestHandler {
|
||||
return this.queue.length === 0 && !this.limited && this.busy !== true;
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line complexity */
|
||||
async execute(item) {
|
||||
// Insert item back to the beginning if currently busy
|
||||
if (this.busy) {
|
||||
@@ -102,9 +104,7 @@ class RequestHandler {
|
||||
} catch (error) {
|
||||
// NodeFetch error expected for all "operational" errors, such as 500 status code
|
||||
this.busy = false;
|
||||
return reject(
|
||||
new HTTPError(error.message, error.constructor.name, error.status, request.method, request.path),
|
||||
);
|
||||
return reject(new HTTPError(error.message, error.constructor.name, error.status, request.method, request.path));
|
||||
}
|
||||
|
||||
if (res && res.headers) {
|
||||
@@ -171,9 +171,7 @@ class RequestHandler {
|
||||
}
|
||||
return null;
|
||||
} catch (err) {
|
||||
return reject(
|
||||
new HTTPError(err.message, err.constructor.name, err.status, request.method, request.path),
|
||||
);
|
||||
return reject(new HTTPError(err.message, err.constructor.name, err.status, request.method, request.path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user