scryfall-sdk icon indicating copy to clipboard operation
scryfall-sdk copied to clipboard

this._listeners[eventName] is not iterable

Open forsureitsme opened this issue 9 months ago • 1 comments

Probably related: #70

Stumbled upon this using the following code:

error: Uncaught (in promise) TypeError: this._listeners[eventName] is not iterable
    at MagicEmitter.emit (file:///workspaces/d8d099a1fadaa81c6e599ecfe83d9f469250a38764467e176adbf0728d8d99f2/node_modules/.deno/[email protected]/node_modules/scryfall-sdk/out/util/EventEmitter.js:70:47)
    at MagicEmitter.emit (file:///workspaces/d8d099a1fadaa81c6e599ecfe83d9f469250a38764467e176adbf0728d8d99f2/node_modules/.deno/[email protected]/node_modules/scryfall-sdk/out/util/MagicEmitter.js:51:22)
    at file:///workspaces/d8d099a1fadaa81c6e599ecfe83d9f469250a38764467e176adbf0728d8d99f2/node_modules/.deno/[email protected]/node_modules/scryfall-sdk/out/api/Cards.js:433:35
    at eventLoopTick (ext:core/01_core.js:168:7)
for await (
  const card of Scry.Cards.search("t:basic", {
    unique: "art",
    order: "released",
    dir: "desc",
  }).all()
) {
  // Omitted irrelevant part
}

After some debugging it looks like it runs throught all of the entries before crashing. I suppose this is not intended because the example on using MagicEmitters's .all() doesn't warn about needing to handle this.

forsureitsme avatar May 27 '24 21:05 forsureitsme