add error response handling
This commit is contained in:
parent
95c14c4e72
commit
a8158c73c8
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name ScoreSaber Utils
|
||||
// @namespace https://ssu.fascinated.cc
|
||||
// @version 1.0.6
|
||||
// @version 1.0.7
|
||||
// @description Useful additions to ScoreSaber!
|
||||
// @author Fascinated
|
||||
// @match https://scoresaber.com/*
|
||||
@ -20,6 +20,11 @@
|
||||
*/
|
||||
async function fetchData(url) {
|
||||
const response = await fetch(url);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch data: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
@ -84,6 +89,7 @@ async function loadPlayerData(path) {
|
||||
|
||||
try {
|
||||
const playerData = await fetchData(`https://ssu.fascinated.cc/account/${playerId}`);
|
||||
|
||||
addStat(
|
||||
".stats-container",
|
||||
"+1 PP",
|
||||
|
Loading…
Reference in New Issue
Block a user