seyfert 2.1.1-dev-11650796728.0 → 2.1.1-dev-11674440750.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api.d.ts +1 -1
- package/lib/api/api.js +4 -6
- package/package.json +1 -1
package/lib/api/api.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare class ApiHandler {
|
|
|
22
22
|
get proxy(): APIRoutes;
|
|
23
23
|
globalUnblock(): void;
|
|
24
24
|
request<T = unknown>(method: HttpMethods, url: `/${string}`, { auth, ...request }?: ApiRequestOptions): Promise<T>;
|
|
25
|
-
parseError(response: Response, result: unknown): Error;
|
|
25
|
+
parseError(method: HttpMethods, route: `/${string}`, response: Response, result: unknown): Error;
|
|
26
26
|
handle50X(method: HttpMethods, url: `/${string}`, request: ApiRequestOptions, next: () => void): Promise<unknown>;
|
|
27
27
|
handle429(route: string, method: HttpMethods, url: `/${string}`, request: ApiRequestOptions, response: Response, result: string, next: () => void, reject: (err: unknown) => void, now: number): Promise<unknown>;
|
|
28
28
|
clearResetInterval(route: string): void;
|
package/lib/api/api.js
CHANGED
|
@@ -132,7 +132,7 @@ class ApiHandler {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
const parsedError = this.parseError(response, result);
|
|
135
|
+
const parsedError = this.parseError(method, route, response, result);
|
|
136
136
|
this.debugger?.warn(parsedError);
|
|
137
137
|
reject(parsedError);
|
|
138
138
|
return;
|
|
@@ -170,7 +170,7 @@ class ApiHandler {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
parseError(response, result) {
|
|
173
|
+
parseError(method, route, response, result) {
|
|
174
174
|
let errMessage = '';
|
|
175
175
|
if (typeof result === 'object' && result) {
|
|
176
176
|
if ('message' in result) {
|
|
@@ -180,10 +180,8 @@ class ApiHandler {
|
|
|
180
180
|
errMessage += `${JSON.stringify(result.errors, null, 2)}\n`;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
return new Error(response.statusText);
|
|
183
|
+
errMessage += ` at [${response.status} ${response.statusText}] ${method} ${route}\n`;
|
|
184
|
+
return new Error(errMessage);
|
|
187
185
|
}
|
|
188
186
|
async handle50X(method, url, request, next) {
|
|
189
187
|
const wait = Math.floor(Math.random() * 1900 + 100);
|