MikeHopcroft / ShortOrder

A natural language conversational agent for ordering and organizing items from a catalog.
MIT License
13 stars 7 forks source link

Break if nextToken is undefined. #46

Closed Wind010 closed 5 years ago

Wind010 commented 5 years ago

Simple fix from debugging. Testing with Repl.

Wind010 commented 5 years ago

Your fix makes sense. I see the same TypeError thrown on my desktop with stack trace.

% two
TypeError: PeekableSequence<T>.peek(): at end of stream.
    at PeekableSequence.peek (C:\git\Starbucks\emerging-tech\ramsey-backend\node_modules\token-flow\build\src\utilities\peekable_sequence.js:13:19)
    at Parser.parseEntity (C:\git\Starbucks\emerging-tech\ramsey-backend\node_modules\short-order\build\src\parser\parser.js:121:49)
    at Parser.parseRoot (C:\git\Starbucks\emerging-tech\ramsey-backend\node_modules\short-order\build\src\parser\parser.js:41:30)
    at Parser.parseTokens (C:\git\Starbucks\emerging-tech\ramsey-backend\node_modules\short-order\build\src\parser\parser.js:35:21)
    at Parser.parseText (C:\git\Starbucks\emerging-tech\ramsey-backend\node_modules\short-order\build\src\parser\parser.js:31:21)
    at REPLServer.myEval (C:\git\Starbucks\emerging-tech\ramsey-backend\dist\importer\repl.js:177:36)
    at bound (domain.js:395:14)
    at REPLServer.runBound [as eval] (domain.js:408:12)
    at REPLServer.onLine (repl.js:640:10)
    at REPLServer.emit (events.js:189:13)

With the version from my laptop running the repl, I didn't see a trace:

% two

TypeError!
QTY ITEM                                     TOTAL
Subtotal
   Tax
Total

I didn't understand that. What else can I get you?

After npm i, the laptop shows the full error above without the receipt.