mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 00:40:07 +00:00
Fix Internal proxy Issue (#2413)
* Fix Internal proxy Issue * deno fmt Co-authored-by: meister03 <meisterpi@gmail.com>
This commit is contained in:
@@ -60,7 +60,12 @@ export async function runMethod<T = any>(
|
||||
url: route[0] === "/" ? `${BASE_URL}/v${API_VERSION}${route}` : route,
|
||||
method,
|
||||
reject: (data: RestRequestRejection) => {
|
||||
const restError = rest.convertRestError(errorStack, data);
|
||||
const newError = new Error("Location:");
|
||||
newError.stack = errorStack.stack as Error["stack"];
|
||||
const restError = rest.convertRestError(
|
||||
newError,
|
||||
data,
|
||||
);
|
||||
reject(restError);
|
||||
},
|
||||
respond: (data: RestRequestResponse) =>
|
||||
|
||||
@@ -86,11 +86,12 @@ export async function sendRequest<T>(rest: RestManager, options: RestSendRequest
|
||||
|
||||
// If NOT rate limited remove from queue
|
||||
if (response.status !== 429) {
|
||||
const body = response.type ? JSON.stringify(await response.json()) : undefined;
|
||||
options.reject?.({
|
||||
ok: false,
|
||||
status: response.status,
|
||||
error,
|
||||
body: response.type ? JSON.stringify(await response.json()) : undefined,
|
||||
body,
|
||||
});
|
||||
|
||||
throw new Error(
|
||||
@@ -98,7 +99,7 @@ export async function sendRequest<T>(rest: RestManager, options: RestSendRequest
|
||||
ok: false,
|
||||
status: response.status,
|
||||
error,
|
||||
body: response.type ? JSON.stringify(await response.json()) : undefined,
|
||||
body,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user