-
Notifications
You must be signed in to change notification settings - Fork 13
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
Align paths in traces #30
Comments
This proposal is currently only attempting to specify the structure, not the contents - but either way, that kind of alignment doesn't match what browsers/engines currently do, so you'd have to build your own function that used the structured data provided by this proposal in order to format the stack trace how you liked. Alignment is a subjective thing; many people like it, but many people (myself included) find it much harder to read. |
I was suggested to implement it in Node.js and open a pull-request for that, I'll try to find some time to do it.
Agree. In my case, I find it better to have them aligned so it's easier to identify the actual functions and their location at a glance, without needing to read/scan all the stack trace lines. |
That's a good reason to make it be a separate utility function, so that you have to opt in to this nonstandard formatting. |
A wrapper function that parses and format the stack trace? Yes, doable, but not a default behaviour when an error ocurrs, that's when you need it... |
Right - but since not everyone will prefer the same default as you, it doesn't make sense to ruin it for them and change the default. I think a wrapper function is the better approach, for node as well. |
Why not split the difference on this one? Add a formatting function to the spec. Default value can be undefined or null. If set, let the getter for |
Or, if we want the paths aligned, we could just swap the order of paths and functions, that way it doesn't take up much horizontal space. It would be nice if it was easier to distinguish the stack frames from external libraries/npm modules, or even different parts of your own projects. I guess the message shown to the end-user when an error actually goes uncaught can use a differently formatted stack trace than what's found in the "stack" property, but I doubt there would be much incentive to deviate from it. And, I see the value in just trying to standardize what implementations are already doing, without forcing them to make changes, so while a different format would be nice, I don't really see that happening in this spec. |
And even people who like it (I do), need different kinds of whitespace in different kinds of projects, e.g.
|
KISS principle: use ASCII whitespaces. |
How can we move this forward? |
It’s not clear there is a path forward here, until after this proposal has landed. |
Are you talking about my proposal of aligned stack traces, or the one of this repo about standarize them? |
This one. Until they’re standardized as-is, it won’t be possible for any proposal to enhance or change them. |
Initially proposed at nodejs/node#22575, and cross-posting here as recommended at nodejs/node#22575 (comment).
When an exception is thrown or when using
console.trace()
, files paths are not aligned making it difficult to follow them at naked eye and specially to identify when it's one of your files, one internal module of if it's a file located insidenode_modules
folder:Not sure if this is done at
v8
level, but my proposal is to add spaces between the function name and the file paths so this last ones gets aligned between themselves to the longest one. In the previous trace, it would get like:There would be problems if some code is parsing the trace output taking in consideration to be just only a space between the function name and the file path instead of several spaces, so this change would need to be in a major version, but anyway exception traces are not standard and such libs are very few and mostly for debuging purposses so their impact will be low, and is a small change that they would be easily added.
The text was updated successfully, but these errors were encountered: