Jump to content


Photo
Question

[v4] Access purchaseResultDetails on key redeeming error

node.js node-steam-user

Best Answer Dr. McKay , 21 February 2019 - 09:01 PM

Promise limitations prevent any arguments besides err from being sent to the callback if an error occurred. If you update to v4.4.3, you'll be able to access this data via the Error object instead, using err.purchaseResultDetails and err.packageList.

Go to the full post


  • Please log in to reply
3 replies to this topic

#1 Catzilla

Catzilla

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 21 February 2019 - 03:18 PM

Hi.

I'm migrating from v3 to v4, and trying to redeem Steam key.
 
I added err argument as described in release notes, and now have the following code:

client.redeemKey(key, (err, detail, packages) => {
    if (err) {
        console.log('Can not redeem: ' + SteamUser.EPurchaseResultDetail[detail]);
        return;
    }
    console.log('Redeemed!');
});

If key can not be redeemed, in v3 I get detailed reason, for example DoesNotOwnRequiredApp.
But in v4 detail argument seems to be undefined.
How can I access this info now, after migration to v4?

Thanks



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,140 posts

Posted 21 February 2019 - 09:01 PM   Best Answer

Promise limitations prevent any arguments besides err from being sent to the callback if an error occurred. If you update to v4.4.3, you'll be able to access this data via the Error object instead, using err.purchaseResultDetails and err.packageList.


  • Catzilla likes this

#3 Catzilla

Catzilla

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 21 February 2019 - 09:52 PM

Works fine, thanks a lot!



#4 Royalgamer06

Royalgamer06

    Advanced Member

  • Member
  • PipPipPip
  • 94 posts

Posted 03 March 2019 - 06:33 PM

I did this for the callback to support the old structure:

(result, detail, packages) => {
                // conversation new to old structure
                if (result) {
                    detail = result.purchaseResultDetails;
                    packages = result.packageList;
                    result = result.eresult;
                } else {
                    result = 1;
                }






Also tagged with one or more of these keywords: Question, node.js, node-steam-user

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users