Oliver-Akins / Phantom-Ink-Online

The online prototype for Resonym's game titled Phantom Ink.
http://phantominkgame.com/
6 stars 2 forks source link

Error Cannot get 0 cards. #64

Closed Oliver-Akins closed 3 years ago

Oliver-Akins commented 3 years ago
Error  Cannot get 0 cards.
error stack:
• Deck.ts:26 draw
    src/objects/Deck.ts:26:10
• SendCard.ts:27 exports.default
    src/events/SendCard.ts:27:39
• websocket.ts:52 socket.on
    src/websocket.ts:52:53
• events.js:198 emit
    events.js:198:13
• socket.js:253 onevent
    node_modules/.pnpm/socket.io@3.0.4/node_modules/socket.io/dist/socket.js:253:20
• socket.js:216 _onpacket
    node_modules/.pnpm/socket.io@3.0.4/node_modules/socket.io/dist/socket.js:216:22
• client.js:205 <anonymous>
    node_modules/.pnpm/socket.io@3.0.4/node_modules/socket.io/dist/client.js:205:28
code frame:
  021 |                  * @param quantity -> The number of cards to draw
  022 |                  * @throws Error -> If quantity is <= 0
  023 |                  * @throws Error -> If quantity > size
  024 |                  */
  025 |                 if (quantity <= 0) {
> 026 |                         throw new Error(`Cannot get ${quantity} cards.`);
                 ^
  027 |                 } else if (quantity > this.size) {
  028 |                         throw new Error(`Cannot draw more cards than there are in the deck.`);
  029 |                 };
  030 |
  031 |                 let cards: T[] = [];