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

Does not support inspecting Errors in v8.x #143

Closed
joyeecheung opened this issue Nov 1, 2017 · 8 comments
Closed

Does not support inspecting Errors in v8.x #143

joyeecheung opened this issue Nov 1, 2017 · 8 comments

Comments

@joyeecheung
Copy link
Member

joyeecheung commented Nov 1, 2017

Looks like v8 has made some significant changes to errors (rewrite in C++), now they are no longer normal objects. The inspection seems to have stopped working since 7.x. I am working on a fix.

@mmarchini
Copy link
Contributor

@joyeecheung is this still an issue?

@joyeecheung
Copy link
Member Author

@mmarchini Yes.

With this:

diff --git a/test/fixtures/inspect-scenario.js b/test/fixtures/inspect-scenario.js
index 11133ac..03a508a 100644
--- a/test/fixtures/inspect-scenario.js
+++ b/test/fixtures/inspect-scenario.js
@@ -57,6 +57,10 @@ function closure() {
   );
   c.hashmap['buffer'] = Buffer.from([0xff, 0xf0, 0x80, 0x0f, 0x01, 0x00]);

+  c.hashmap['error'] = new Error('test');
+  c.hashmap['error'].code = 'ERR_TEST';
+  c.hashmap['error'].errno = 1;
+
   c.hashmap[0] = null;
   c.hashmap[4] = undefined;
   c.hashmap[23] = /regexp/;

I got:

.error=0x00000c0ad02d0b59:<unknown>,

@mmarchini
Copy link
Contributor

@joyeecheung are you still working on this? If not, would you mind if I take this on?

@joyeecheung
Copy link
Member Author

@mmarchini I probably lost the initial investigation with my last laptop...feel free to take this!

@mmarchini
Copy link
Contributor

Adding a new postmortem metadata to V8 (JS_ERROR_TYPE) does the trick, but the .stack property is still unrecognized by llnode:

0x00003347c1720999:<Object: Error properties {
    .stack=<unknown field type>,
    .message=0x000033477c697aa9:<String: "test">,
    .<non-string>=0x00003347c1720bd1:<Array: length=46>,
    .code=0x000033477f7d1cc1:<String: "ERR_TEST">,
    .errno=<Smi: 1>}>

@misterdjules
Copy link

@mmarchini Isn't the stack property an accessor that replaces itself with a data property at runtime with the formatted stack trace? Could that explain why llnode has some difficulties displaying some useful info about it?

@mmarchini
Copy link
Contributor

@misterdjules yep, that's what I got so far as well. The actual stack trace seems to be stored in the .<non-string>=0x00003347c1720bd1:<Array: length=46>, unfolding it should be enough to get a nice stack trace for the Error object. I'm also working on #156 to display the symbol of this property correctly.

mmarchini pushed a commit to mmarchini/llnode that referenced this issue Jul 16, 2018
This commit fixes JSError inspection for Node.js v7+. We still need to
figure out a way to get the stack from the Error object though.

Ref: nodejs#143
mmarchini pushed a commit to mmarchini/llnode that referenced this issue Aug 8, 2018
This commit fixes JSError inspection for Node.js v7+. We still need to
figure out a way to get the stack from the Error object though.

Ref: nodejs#143
mmarchini pushed a commit to mmarchini/llnode that referenced this issue Sep 11, 2018
This commit fixes JSError inspection for Node.js v7+. We still need to
figure out a way to get the stack from the Error object though.

Ref: nodejs#143
mmarchini pushed a commit that referenced this issue Sep 11, 2018
This commit fixes JSError inspection for Node.js v7+. We still need to
figure out a way to get the stack from the Error object though.

Ref: #143

PR-URL: #215
Refs: #143
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@mmarchini
Copy link
Contributor

Fixed by #215

hyj1991 pushed a commit to aliyun-node/llnode that referenced this issue Sep 17, 2018
This commit fixes JSError inspection for Node.js v7+. We still need to
figure out a way to get the stack from the Error object though.

Ref: nodejs#143

PR-URL: nodejs#215
Refs: nodejs#143
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants