mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
feat: no-de-no-de, now with extra buns (#9683)
BREAKING CHANGE: The REST and RequestManager classes now extend AsyncEventEmitter from `@vladfrangu/async_event_emitter`, which aids in cross-compatibility between Node, Deno, Bun, CF Workers, Vercel Functions, etc. BREAKING CHANGE: DefaultUserAgentAppendix has been adapted to support multiple different platforms (previously mentioned Deno, Bun, CF Workers, etc) BREAKING CHANGE: the entry point for `@discordjs/rest` will now differ in non-node-like environments (CF Workers, etc.) Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: suneettipirneni <suneettipirneni@icloud.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { STATUS_CODES } from 'node:http';
|
||||
import type { InternalRequest } from '../RequestManager.js';
|
||||
import type { RequestBody } from './DiscordAPIError.js';
|
||||
|
||||
@@ -12,18 +11,19 @@ export class HTTPError extends Error {
|
||||
|
||||
/**
|
||||
* @param status - The status code of the response
|
||||
* @param statusText - The status text of the response
|
||||
* @param method - The method of the request that erred
|
||||
* @param url - The url of the request that erred
|
||||
* @param bodyData - The unparsed data for the request that errored
|
||||
*/
|
||||
public constructor(
|
||||
public status: number,
|
||||
statusText: string,
|
||||
public method: string,
|
||||
public url: string,
|
||||
bodyData: Pick<InternalRequest, 'body' | 'files'>,
|
||||
) {
|
||||
super(STATUS_CODES[status]);
|
||||
|
||||
super(statusText);
|
||||
this.requestBody = { files: bodyData.files, json: bodyData.body };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user