ChiriVulpes / scryfall-sdk

A Node.js SDK for https://scryfall.com/docs/api, written in TypeScript.
MIT License
99 stars 16 forks source link

Failed Fuzzy search returns a strange format #45

Closed multimeric closed 2 years ago

multimeric commented 2 years ago

If I:

const Scry = require("scryfall-sdk");
await Scry.Cards.byName("rstdrdtst", true);

I get an object like this, which doesn't actually tell me that I've encountered an error or what the error was:

{
  "data": [],
  "not_found": []
}

However querying the actual Scryfall API with a similar request (curl 'https://api.scryfall.com/cards/named?fuzzy=rstdrdtst') , I get a much more helpful response:

{
  "object": "error",
  "code": "not_found",
  "status": 404,
  "details": "No cards found matching “rstdrdtst”"
}

It would be great if we could get this response instead.

ChiriVulpes commented 2 years ago

If you get no results you can query Scry.error() to get the previous error object I believe? Or something like that. Lemme know if that doesn't work