summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-01-31 20:29:28 -0500
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-01-31 20:29:28 -0500
commitf65cee80a47f093dbdc51fc26ace8d92b99b4f07 (patch)
treedaec77006a77bd2a41b3a0800e85b5ffba4b641f
parentad238b3a1961a3431bbcaaf45796447606316268 (diff)
downloadDecky-Framegen-f65cee80a47f093dbdc51fc26ace8d92b99b4f07.tar.gz
Decky-Framegen-f65cee80a47f093dbdc51fc26ace8d92b99b4f07.zip
feat: add try, catch, logging non success to InstalledGamesSection
-rwxr-xr-xsrc/index.tsx28
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);
}
};