question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Offer state "undefined". What to do?

See original GitHub issue

So, i’ve created small bot which should accept trades. Scenario is well known.

Some small part of code.

manager.on('newOffer', function(offer) {
  /* SOME FUNCTIONS & CHECKS */
  // Try to accept the offer
  offer.accept(function(err, status) {
    console.log('ACCEPTED OFFER STATE: ' + status);

    if(status == 'accepted') {

      /* DO MYSQL STUFF & MORE */

    }
  });
});

I check if trade status was accepted and let the server do the stuff. But… Sometimes trade status is “unknown” and trade offer is accepted anyway. No error, just unknown. Will simple if(status != accepted) { return; } skip the acceptation until next check? Or its better just to .decline() the offer?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kinsi55commented, Dec 10, 2015

Learn to properly code, and best practices and error handling before creating anything around Steams good, stable system 😉

0reactions
yaneonycommented, Dec 10, 2015

That was just an example, for people like you i will add big fat red notice about that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Watch Out for Undefined State - Dave Ceddia
This is easy to fix. The simplest way: initialize state with reasonable default values in the constructor. ... This is not the ideal...
Read more >
React State giving undefined, new to react - Stack Overflow
I'm new to react-native, I have been working on a simple app but for some reason I keep getting (undefined) for some of...
Read more >
React JS UNDEFINED Solution | Reactjs Learning - YouTube
Whenever you fetch data or call an API to display record in React JS components, always make sure data is stored in state....
Read more >
Deal with Undefined 'this' in React Event Handlers Correctly
When teaching React to developers, one thing that comes up often is dealing with a common error. In this post, learn how to...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found