Jump to content
McKay Development

Recommended Posts

Posted

Hello !

 

How should i properly handle this error ?

 

I wrapped offer.accept into Promise

 

and when i catch error then i get errCode and if errCode === 28 what way to re-accept this offer properly ?

should i return false and then try to accept offer again ? or update somehow ?

Posted (edited)

Having the same issue. Everything works except the handling of error 28.

I made a retry function but it keeps saying that offer.accept is not a function (Line 73)


 

manager.on('newOffer', function (offer) {
    console.log("New offer #" + offer.id + " from " + offer.partner.getSteam3RenderedID());
    offer.accept(function (err) {
        if (err) {
            console.log("Unable to accept offer: " + err.message);
            console.log("Cause: " + err.eresult);
            if (err.eresult == 28) {
                retryOffer(offer.id);
            }
        }
        else {
            steam.checkConfirmations(); 
            console.log("Offer accepted");
        }
    });
});

function retryOffer(id) {
    manager.getOffer(id, function (err,offer) {
        if (err) {
            console.log("Unable to get offer: " + err.message);
                console.log("Retrying to get.");
                setTimeout(function(){ 
                retryOffer(id);
                }, retryTime);
        }
        else {
            offer.accept(function (err) {
                if (err) {
                    console.log("Unable to accept offer: " + err.message);
                    if (err.eresult == 28) {
                        console.log("Retrying to accept.");
                        retryOffer(offer.id);
                    }
                }
                else {
                    steam.checkConfirmations();
                    console.log("Offer accepted");
                }
            });
        }
    });
}


Edit: Fixed the code. Maybe someone finds that useful. Thanks Dr. McKay. Awesome project, awesome help!

 

Edited by Freshdachs

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...