refactor(rest): rename attachment to file (#7199)

This commit is contained in:
ckohen
2022-01-07 15:49:34 -08:00
committed by GitHub
parent 3872acfeb8
commit c969cbf652
8 changed files with 48 additions and 48 deletions

View File

@@ -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 };
}
/**

View File

@@ -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 };
}
}