mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: better blitz fetch error management
This commit is contained in:
1 parent
87e23673fb
commit
dfba8bd15f
1 file changed
+5
-1
@@ -17,7 +17,7 @@ async function manageQueue() {
|
||||
if (queue.length > 0 && inProgress < MAX_CALLS_PER_SECOND) {
|
||||
inProgress++;
|
||||
|
||||
setTimeout(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
inProgress--;
|
||||
manageQueue();
|
||||
}, 1000);
|
||||
@@ -32,6 +32,10 @@ async function manageQueue() {
|
||||
if (data.status === 'ok') {
|
||||
resolve(data.data);
|
||||
} else {
|
||||
clearTimeout(timeout);
|
||||
inProgress--;
|
||||
manageQueue();
|
||||
|
||||
throw new Error(`Wargaming response error status: "${data.status}"`, {
|
||||
cause: `Message: "${data.error.message}"\nURL: "${url}"`,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user