diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-31 20:29:28 -0500 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-31 20:29:28 -0500 |
| commit | f65cee80a47f093dbdc51fc26ace8d92b99b4f07 (patch) | |
| tree | daec77006a77bd2a41b3a0800e85b5ffba4b641f | |
| parent | ad238b3a1961a3431bbcaaf45796447606316268 (diff) | |
| download | Decky-Framegen-f65cee80a47f093dbdc51fc26ace8d92b99b4f07.tar.gz Decky-Framegen-f65cee80a47f093dbdc51fc26ace8d92b99b4f07.zip | |
feat: add try, catch, logging non success to InstalledGamesSection
| -rwxr-xr-x | src/index.tsx | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/index.tsx b/src/index.tsx index fb4d3ae..52c3128 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -169,17 +169,23 @@ function InstalledGamesSection() { useEffect(() => { const fetchGames = async () => { - const result = await listInstalledGames(); - if (result.status === "success") { - const sortedGames = [...result.games] - .map(game => ({ - ...game, - appid: parseInt(game.appid, 10), // Convert string to number - })) - .sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase())); - setGames(sortedGames); - } else { - console.error("Failed to fetch games"); + try { + const response = await listInstalledGames(); + console.log("listInstalledGames response:", response); + if (response.status === "success") { + const sortedGames = [...response.games] + .map(game => ({ + ...game, + appid: parseInt(game.appid, 10), // Convert string to number + })) + .sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase())); + console.log("Fetched games successfully:", sortedGames.length); + setGames(sortedGames); + } else { + console.error("Failed to fetch games:", response); + } + } catch (error) { + console.error("Error fetching games:", error); } }; |
