Closed fungilation closed 1 year ago
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch steamapi@2.2.0 for the project I'm working on.
steamapi@2.2.0
Here is the diff that solved my problem:
diff --git a/node_modules/steamapi/src/SteamAPI.js b/node_modules/steamapi/src/SteamAPI.js index d479a8b..f291dc4 100644 --- a/node_modules/steamapi/src/SteamAPI.js +++ b/node_modules/steamapi/src/SteamAPI.js @@ -291,7 +291,7 @@ class SteamAPI { */ getUserBans(id) { const arr = Array.isArray(id); - if ((arr && id.some(i => !reID.test(i))) || (!arr && !reID.test(id))) return Promise.reject(new TypeError('Invalid/no id provided')); + if ((arr && id.some(i => !reID.test(i))) || (!arr && !reID.test(id))) return console.error('SteamAPI: Invalid/no id provided'); return this .get(`/ISteamUser/GetPlayerBans/v1?steamids=${id}`) @@ -299,7 +299,7 @@ class SteamAPI { ? arr ? json.players.map(player => new PlayerBans(player)) : new PlayerBans(json.players[0]) - : Promise.reject(new Error('No players found')) + : console.error('SteamAPI: No players found') ); } @@ -351,11 +351,11 @@ class SteamAPI { * @returns {Promise<Game[]>} Owned games */ getUserOwnedGames(id) { - if (!reID.test(id)) return Promise.reject(new TypeError('Invalid/no id provided')); + if (!reID.test(id)) return console.error('SteamAPI: Invalid/no id provided'); return this .get(`/IPlayerService/GetOwnedGames/v1?steamid=${id}&include_appinfo=1`) - .then(json => json.response.games ? json.response.games.map(game => new Game(game)) : Promise.reject(new Error('No games found'))); + .then(json => json.response.games ? json.response.games.map(game => new Game(game)) : console.error('SteamAPI: No games found')); } /**
This issue body was partially generated by patch-package.
I'm confused as to how this is a fix. This just makes it harder to handle errors. Perhaps you should make your code handle promise rejections instead?
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
steamapi@2.2.0
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.