KiTa Posted August 11, 2016 Report Posted August 11, 2016 For some reason I consistently get this error after receiving a trade offer. steam_bot.js:217 if (them.escrowDays <= 0) { ^ TypeError: Cannot read property 'escrowDays' of undefined at /home/teslim/steam-bot/steam_bot.js:217:17 at Object.exports.makeAnError (/home/teslim/steam-bot/node_modules/steam-tradeoffer-manager/lib/helpers.js:33:4) at manager._community.httpRequestGet (/home/teslim/steam-bot/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:752:12) at SteamCommunity._checkCommunityError (/home/teslim/steam-bot/node_modules/steamcommunity/components/http.js:129:3) at Request._callback (/home/teslim/steam-bot/node_modules/steamcommunity/components/http.js:51:88) at Request.self.callback (/home/teslim/steam-bot/node_modules/request/request.js:187:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (/home/teslim/steam-bot/node_modules/request/request.js:1044:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) Quote
Dr. McKay Posted August 11, 2016 Report Posted August 11, 2016 Sounds like you aren't checking the error. Can I see the code? Quote
KiTa Posted August 12, 2016 Author Report Posted August 12, 2016 manager.on('newOffer', function(offer) { console.log("New offer #" + offer.id + " from " + offer.partner.getSteam3RenderedID()); offer.getUserDetails(function(err, me, them) { if (them.escrowDays <= 0) { if (offer.partner.getSteamID64() == config.owner) { offer.accept(function(err) { if (err) { console.log("Unable to accept offer: " + err.message); } else { community.checkConfirmations(); // Check for confirmations right after accepting the offer console.log("Offer from master accepted"); } }); } else if (offer.itemsToGive.length == 0 && !offer.isGlitched()) { offer.accept(function(err) { if (err) { console.log("Unable to accept offer: " + err.message); } else { community.checkConfirmations(); // Check for confirmations right after accepting the offer console.log("Gift from " + offer.partner.getSteamID64() + " accepted"); } }); } else { validate(offer, function(accept, report) { if (accept) { offer.accept(function(err) { if (err) { console.log("Unable to accept offer: " + err.message); } else { community.checkConfirmations(); // Check for confirmations right after accepting the offer console.log("Offer from " + offer.partner.getSteamID64() + " accepted"); } }); } else if (report) { console.log("Reporting trade #" + offer.id); } else { offer.decline(); } }); } } else { offer.decline(); } }); }); Quote
Dr. McKay Posted August 12, 2016 Report Posted August 12, 2016 You aren't checking the error. In every callback, if err is truthy, then there was an error and all other arguments are undefined. KiTa 1 Quote
KiTa Posted August 12, 2016 Author Report Posted August 12, 2016 Sorry I learned js from a Java teacher, but this is meant to debug not the actual solution right? Quote
Dr. McKay Posted August 12, 2016 Report Posted August 12, 2016 No, that's the actual solution. Errors are a fact of life (especially when you're working with Steam). You need to handle them, or else you'll crash. KiTa 1 Quote
KiTa Posted August 15, 2016 Author Report Posted August 15, 2016 It seems this is also an issue with steam as the TradeOffer class is returning an http error. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.