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

repl: do not crash on async op reject #3527

Merged
merged 2 commits into from
Dec 20, 2019

Conversation

kevinkassimo
Copy link
Contributor

Adds a custom error handler that only prints instead of exiting the process when an async error is thrown (which cannot be caught by repl loop).

Before:

> Deno.open()
Promise {}
> error: Uncaught InvalidData: missing field `filename`
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)

(Process crashes, terminal mode is not properly set and keys pressed are not echoed back to terminal)

After:

> Deno.open()
Promise {}
> error: Uncaught InvalidData: missing field `filename`
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
> console.log("not crashed")
not crashed
undefined
>

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@ry ry merged commit 9ef0b18 into denoland:master Dec 20, 2019
bartlomieju pushed a commit to bartlomieju/deno that referenced this pull request Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants