Parsing error in responses with more than one item in the list
Somefellow opened this issue · 5 comments
Somefellow commented
scryfall.get('cards/search', {
q: 't:scheme'
}).then(list => {
list.forEach(card => {
console.log(card.name);
});
}).catch(error => {
console.log(error);
});
{ Error
at new ScryfallError (C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\models\scryfall-error.js:5:16)
at IncomingMessage.<anonymous> (C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\request.js:86:37)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
message: 'Could not parse response from Scryfall.',
stack: 'Error\n at new ScryfallError (C:\\Aidas\\Projects\\Scryfall\\node_modules\\scryfall-client\\models\\scryfall-error.js:5:16)\n at IncomingMessage.<anonymous> (C:\\Aidas\\Projects\\Scryfall\\node_modules\\scryfall-client\\lib\\request.js:86:37)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (_stream_readable.js:1064:12)\n at _combinedTickCallback (internal/process/next_tick.js:139:11)\n at process._tickCallback (internal/process/next_tick.js:181:9)',
thrownError: TypeError: Cannot read property 'object' of null
at wrapScryfallResponse (C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\wrap-scryfall-response.js:23:17)
at C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\wrap-scryfall-response.js:37:30
at Array.forEach (<anonymous>)
at wrapScryfallResponse (C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\wrap-scryfall-response.js:36:27)
at C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\wrap-scryfall-response.js:37:30
at Array.forEach (<anonymous>)
at wrapScryfallResponse (C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\wrap-scryfall-response.js:36:27)
at C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\wrap-scryfall-response.js:33:35
at Array.forEach (<anonymous>)
at wrapScryfallResponse (C:\Aidas\Projects\Scryfall\node_modules\scryfall-client\lib\wrap-scryfall-response.js:32:21) }
crookedneighbor commented
Thanks for the report. Something must have changed recently in the API. I’ll take a look.
crookedneighbor commented
This is fixed in 0.8.2.
Scryfall started sending null
for foil prices that were not known, which wasn't handled correctly in the module.
crookedneighbor commented
Also, would love to see whatever you're building that is using this library!
Somefellow commented
You can see something I've been working on on-and-off for a bit. Using this module has allowed me remove a lot of json parsing and validating boilerplate, and error handle much cleaner.
crookedneighbor commented
Very cool. Thanks for sharing it!