Handle errors

This commit is contained in:
Natsumi
2024-10-07 20:09:30 +13:00
parent d16928f6de
commit d16d8399ca
2 changed files with 39 additions and 21 deletions

View File

@@ -2906,10 +2906,13 @@ speechSynthesis.getVoices();
try {
var args = await this.getFriends(params);
friends = friends.concat(args.json);
params.offset += 50;
break;
} catch (err) {
console.error(err);
if (err?.message?.includes('Not Found')) {
console.error('Awful workaround for awful VRC API bug');
break;
}
if (j === 9) {
throw err;
}
@@ -2918,6 +2921,7 @@ speechSynthesis.getVoices();
});
}
}
params.offset += 50;
}
return friends;
};
@@ -2944,10 +2948,13 @@ speechSynthesis.getVoices();
try {
var args = await this.getFriends(params);
friends = friends.concat(args.json);
params.offset += 50;
break;
} catch (err) {
console.error(err);
if (err?.message?.includes('Not Found')) {
console.error('Awful workaround for awful VRC API bug');
break;
}
if (j === 9) {
throw err;
}
@@ -2955,6 +2962,7 @@ speechSynthesis.getVoices();
workerTimers.setTimeout(resolve, 5000);
});
}
params.offset += 50;
}
}
return friends;
@@ -5444,9 +5452,11 @@ speechSynthesis.getVoices();
}
try {
const params = new URLSearchParams(new URL(url).search);
let version = params.get('v');
if (version) return version;
return '0'
const version = params.get('v');
if (version) {
return version;
}
return '0';
} catch {
return '0';
}
@@ -9174,7 +9184,9 @@ speechSynthesis.getVoices();
console.error(err);
});
}
await API.refreshFriends();
await API.refreshFriends().catch((err) => {
console.error(err);
});
API.reconnectWebSocket();
};