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

Error handler always reads error.stack, regardless of type (and blows up) #935

Closed
qoh opened this issue Oct 7, 2018 · 1 comment · Fixed by #939
Closed

Error handler always reads error.stack, regardless of type (and blows up) #935

qoh opened this issue Oct 7, 2018 · 1 comment · Fixed by #939

Comments

@qoh
Copy link
Contributor

qoh commented Oct 7, 2018

The uncaught error handler seems to always try to display the stack property of the caught value, regardless of whether that value is an instance of Error or even an object at all.

This can either just be confusing:

$ cat object.ts
throw {};
$ deno object.ts
Compiling /.../object.ts
undefined

Or worse, fail entirely:

$ cat null.ts
throw null;
$ deno null.ts
Compiling /.../null.ts
ERROR RS - 

It isn't good practice to throw values that aren't instances of Error, but it happens.

@kitsonk
Copy link
Contributor

kitsonk commented Oct 7, 2018

For comparision, this is what Node.js does:

$ node
> throw {};
Thrown: [object Object]
> throw null;
Thrown: null
> 

And Chrome:

throw {};
VM121:1 Uncaught {}
(anonymous) @ VM121:1
throw null;
VM137:1 Uncaught null
(anonymous) @ VM137:1

@ry ry closed this as completed in #939 Oct 8, 2018
ry added a commit to ry/deno that referenced this issue Oct 12, 2018
- Add --types command line flag.
- Add metrics()
- Add redirect follow feature denoland#934
- Fix clearTimer bug denoland#942
- Improve error printing denoland#935
- Expose I/O interfaces Closer, Seeker, ReaderCloser, WriteCloser,
  ReadSeeker, WriteSeeker, ReadWriteCloser, ReadWriteSeeker
- Fix silent death on double await denoland#919
- Add Conn.closeRead() and Conn.closeWrite() denoland#903
@ry ry mentioned this issue Oct 12, 2018
ry added a commit to ry/deno that referenced this issue Oct 12, 2018
- Fix promise reject issue (denoland#936)
- Add --types command line flag.
- Add metrics()
- Add redirect follow feature denoland#934
- Fix clearTimer bug denoland#942
- Improve error printing denoland#935
- Expose I/O interfaces Closer, Seeker, ReaderCloser, WriteCloser,
  ReadSeeker, WriteSeeker, ReadWriteCloser, ReadWriteSeeker
- Fix silent death on double await denoland#919
- Add Conn.closeRead() and Conn.closeWrite() denoland#903
ry added a commit that referenced this issue Oct 12, 2018
- Fix promise reject issue (#936)
- Add --types command line flag.
- Add metrics()
- Add redirect follow feature #934
- Fix clearTimer bug #942
- Improve error printing #935
- Expose I/O interfaces Closer, Seeker, ReaderCloser, WriteCloser,
  ReadSeeker, WriteSeeker, ReadWriteCloser, ReadWriteSeeker
- Fix silent death on double await #919
- Add Conn.closeRead() and Conn.closeWrite() #903
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 a pull request may close this issue.

2 participants