mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
refactor(rest): rename attachment to file (#7199)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { InternalRequest, RawAttachment } from '../RequestManager';
|
||||
import type { InternalRequest, RawFile } from '../RequestManager';
|
||||
|
||||
interface DiscordErrorFieldInformation {
|
||||
code: string;
|
||||
@@ -23,7 +23,7 @@ export interface OAuthErrorData {
|
||||
}
|
||||
|
||||
export interface RequestBody {
|
||||
attachments: RawAttachment[] | undefined;
|
||||
files: RawFile[] | undefined;
|
||||
json: unknown | undefined;
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@ export class DiscordAPIError extends Error {
|
||||
public status: number,
|
||||
public method: string,
|
||||
public url: string,
|
||||
bodyData: Pick<InternalRequest, 'attachments' | 'body'>,
|
||||
bodyData: Pick<InternalRequest, 'files' | 'body'>,
|
||||
) {
|
||||
super(DiscordAPIError.getMessage(rawError));
|
||||
|
||||
this.requestBody = { attachments: bodyData.attachments, json: bodyData.body };
|
||||
this.requestBody = { files: bodyData.files, json: bodyData.body };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,10 +21,10 @@ export class HTTPError extends Error {
|
||||
public status: number,
|
||||
public method: string,
|
||||
public url: string,
|
||||
bodyData: Pick<InternalRequest, 'attachments' | 'body'>,
|
||||
bodyData: Pick<InternalRequest, 'files' | 'body'>,
|
||||
) {
|
||||
super(message);
|
||||
|
||||
this.requestBody = { attachments: bodyData.attachments, json: bodyData.body };
|
||||
this.requestBody = { files: bodyData.files, json: bodyData.body };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user