Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug: Runtime errors crash the REPL #45

Closed
danvk opened this issue Feb 3, 2024 · 0 comments · Fixed by #47
Closed

🐛 Bug: Runtime errors crash the REPL #45

danvk opened this issue Feb 3, 2024 · 0 comments · Fixed by #47
Labels
type: bug Something isn't working :( 🐛

Comments

@danvk
Copy link
Owner

danvk commented Feb 3, 2024

Expected

The REPL should print runtime errors and let you continue.

Actual

The REPL crashes.

Additional Info

$ npx gravlax
> 1 + nil
node:internal/readline/emitKeypressEvents:74
            throw err;
            ^

RuntimeError: Operands must be two numbers/currencies or two strings.
    at Interpreter.binary (file:///Users/danvk/github/gravlax/lib/interpreter.js:86:19)
    at Interpreter.evaluate (file:///Users/danvk/github/gravlax/lib/interpreter.js:172:21)
    at Interface.<anonymous> (file:///Users/danvk/github/gravlax/lib/main.js:32:41)
    at Interface.emit (node:events:518:28)
    at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)
    at [_line] [as _line] (node:internal/readline/interface:887:18)
    at [_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1265:22)
    at ReadStream.onkeypress (node:internal/readline/interface:264:20)
    at ReadStream.emit (node:events:518:28)
    at emitKeys (node:internal/readline/utils:371:14) {
  token: { lexeme: '+', line: 1, literal: null, type: '+' }
}

Node.js v20.11.0
@danvk danvk added the type: bug Something isn't working :( 🐛 label Feb 3, 2024
@danvk danvk closed this as completed in #47 Feb 4, 2024
danvk added a commit that referenced this issue Feb 4, 2024
## Overview

Fixes #45 

The interesting part is testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working :( 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant