Jump to content
McKay Development

Recommended Posts

Posted (edited)

Hello world :3.

I'm trying to catch any posible error output when i login.

First i tried with try catch, but it didn't work in any way i tried, then investigating i got to know that it needed to be done by adding an event listener to the error event, but when i try to implement the event listener, i get the error that evenlistener is not a function:

client.logOn.addEventListener("error", function(err) {
  if ( err ) {
    console.log('Critical error!!!!! '+ err + ' Check data of:'+client.steamID)
  }
}, true);

Since i already did this post, i'll add one more question;

How can i call the value from a diferent place, for example if i want to show the value of "limited" from client.on('accountLimitations'), and call it in a fs.writefile that i have inside client.on('loggedOn', i have to do it by making a global.limited, or how can i?, the other way i tried was client.accountLimitations.limited, but it always gets a undefined or null result.

Sorry for the bother and noob questions :v

Thanks for taking the time to read my problem.

Have a great day.

Edited by Raminos
Posted

To handle errors:

client.on('error', function(err) {
    // do something with err (which will never be null or undefined in this event)
});

You aren't going to be able to do anything with limited inside of the loggedOn event. The data isn't going to be available yet. loggedOn gets emitted when Steam sends us back the logon response saying that your logon was successful, but Steam doesn't send us our account limitations for another second or so, which is why the data is undefined/null inside of the loggedOn event.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...