Open
Bug 1046256
Opened 10 years ago
Updated 2 years ago
Parse Error.stack to render a proper stacktrace
Categories
(DevTools :: Console, enhancement, P2)
DevTools
Console
Tracking
(Not tracked)
NEW
People
(Reporter: hello, Unassigned)
References
Details
(Whiteboard: [polish-backlog])
Attachments
(1 file)
89.10 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0 (Beta/Release)
Build ID: 20140730004005
Steps to reproduce:
To reproduce display any stack trace in the Dev Tools console via console.error().
Something like:
function stackTrace() {
try {
bar++;
} catch (e) {
console.error(e.stack);
}
}
stackTrace();
Actual results:
FireFox dev tools shows a difficult-to-read stack with dead links like this:
__exports__.default<.setupController@http://127.0.0.1:4200/assets/app.js line 45 > eval:12:9
superWrapper@http://127.0.0.1:4200/assets/vendor.js:14443:11
Ember.Route<.setup@http://127.0.0.1:4200/assets/vendor.js:49502:9
handlerEnteredOrUpdated@http://127.0.0.1:4200/assets/vendor.js:46740:28
@http://127.0.0.1:4200/assets/vendor.js:46709:18
(side note: if I regex the stack to add some spacing myself the links do become clickable. However they open in a new tab with a 404 instead of in dev tools)
Chrome displays a formatted stack like this with the links being clickable (it opens the file in Sources and highlights the specified line):
Error while loading route: ReferenceError: foo is not defined ReferenceError: foo is not defined
at __exports__.default.Ember.Route.extend.setupController (app/routes/index.js:12:13)
at superWrapper [as setupController] (http://127.0.0.1:4200/assets/vendor.js:14443:16)
at Ember.Route.Ember.Object.extend.setup (http://127.0.0.1:4200/assets/vendor.js:49502:14)
at handlerEnteredOrUpdated (http://127.0.0.1:4200/assets/vendor.js:46740:36)
at http://127.0.0.1:4200/assets/vendor.js:46709:18
Expected results:
1. Links should be clickable and should navigate to the correct line.
2. If the @ moves to the front of the line it then gives nice formatting even if the function name is missing:
3. Indenting by a couple spaces would be nice for when the stack is displayed the error message.
at __exports__.default<.setupController http://127.0.0.1:4200/assets/app.js line 45 > eval:12:9
at superWrapper http://127.0.0.1:4200/assets/vendor.js:14443:11
at Ember.Route<.setup http://127.0.0.1:4200/assets/vendor.js:49502:9
at handlerEnteredOrUpdated http://127.0.0.1:4200/assets/vendor.js:46740:28
at http://127.0.0.1:4200/assets/vendor.js:46709:18
Note that Chrome currently displays the error message as part of e.stack. This is why the Chrome stack above has the actual error prepended while Firefox does not.
Comment 1•10 years ago
|
||
A test case showing with console.error(e) and console.error(e.stack): http://fiddle.jshell.net/bgrins/hmfu9/show/
Status: UNCONFIRMED → NEW
Component: Untriaged → Developer Tools: Console
Ever confirmed: true
Comment 2•10 years ago
|
||
Screenshot of the test case.
Notice that in the top message where an exception object is being passed into the console.error the whole message + stack trace is clickable and opens the object in the variables view. It would be great if each individual URL in the stack trace was linkified and navigated to the debugger. Maybe the error message alone could be clickable to open the variables view.
Updated•10 years ago
|
OS: Linux → All
Hardware: x86_64 → All
Version: 33 Branch → Trunk
Updated•9 years ago
|
Priority: -- → P2
Comment hidden (metoo) |
Updated•6 years ago
|
Product: Firefox → DevTools
Updated•6 years ago
|
Summary: console.error() displays a stack trace with no formatting → Parse Error.stack to render a proper stacktrace
Updated•5 years ago
|
Type: defect → enhancement
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•