Repository navigation
Diagnostics report: inspect the error object #28415
Copy link
Copy link
Closed
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.reportIssues and PRs related to Node.js diagnostic reports.Issues and PRs related to Node.js diagnostic reports.
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.reportIssues and PRs related to Node.js diagnostic reports.Issues and PRs related to Node.js diagnostic reports.
on Jun 25, 2019 related code lines:
Lines 352 to 388 in c42da5e
static void PrintJavaScriptStack(JSONWriter* writer, Isolate* isolate, Local<String> stackstr, const char* trigger) { writer->json_objectstart("javascriptStack"); std::string ss; if ((!strcmp(trigger, "FatalError")) || (!strcmp(trigger, "Signal"))) { ss = "No stack.\nUnavailable.\n"; } else { String::Utf8Value sv(isolate, stackstr); ss = std::string(*sv, sv.length()); } int line = ss.find('\n'); if (line == -1) { writer->json_keyvalue("message", ss); writer->json_objectend(); } else { std::string l = ss.substr(0, line); writer->json_keyvalue("message", l); writer->json_arraystart("stack"); ss = ss.substr(line + 1); line = ss.find('\n'); while (line != -1) { l = ss.substr(0, line); l.erase(l.begin(), std::find_if(l.begin(), l.end(), [](int ch) { return !std::iswspace(ch); })); writer->json_element(l); ss = ss.substr(line + 1); line = ss.find('\n'); } } writer->json_arrayend(); writer->json_objectend(); } I'm working on this.
I think I've done this, see #28426
landed in 870f0fc
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.reportIssues and PRs related to Node.js diagnostic reports.Issues and PRs related to Node.js diagnostic reports.
Is your feature request related to a problem? Please describe.
Now we inspect the error object on fatal errors, which is awesome. I started to play with node-report recently and this feature was not incorporated there yet. I think this would make a lot of sense since it would make the report more useful for users.
Describe the solution you'd like
Take the program below as an example:
Today it will output the following stack trace (see how it also prints the custom attribute we added):
The report for this error looks like this today:
It would be amazing if we had the properties as well, as shown below:
Describe alternatives you've considered
The only alternative as powerful as this would be core dumps, but the entry barrier for core dumps is way higher than node-report.