Uh oh!
There was an error while loading. Please reload this page.
take ownership of prepareStackTrace for upstream v8 changes - #23926
Conversation
devsnek
commented
Oct 27, 2018
I'm also unsure of how this should be semver classified. |
Uh oh!
There was an error while loading. Please reload this page.
refack
left a comment
There was a problem hiding this comment.
1st commit looks good with nits, and style conformance.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
refack
left a comment
There was a problem hiding this comment.
4th commit looks good with nits.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
refack
commented
Oct 27, 2018
+1 I like the idea of owning |
fe70f4e to
f36a5e3Comparedevsnek
commented
Oct 29, 2018
@nodejs/assert can someone take a look at how this effects |
Uh oh!
There was an error while loading. Please reload this page.
I've compiled the PR but haven't had a chance to check it against my use case. I should be able to in the next couple days though. Update: It looks like I can work with this change. It doesn't re-decorate decorated stacks so for me this should be OK. |
devsnek
commented
Nov 3, 2018
@nodejs/assert another ping... can someone take a look at what changes need to be made to assertion error decoration |
refack
commented
Nov 3, 2018
Curiosity CI: https://ci.nodejs.org/job/node-test-pull-request/18320/ |
Uh oh!
There was an error while loading. Please reload this page.
Trott
commented
Nov 4, 2018
@BridgeAR Any chance you have some time to look at this proposed change? |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Nit: We do not really use multi line template strings in /lib. It would be nice to replace this using string concat.
There was a problem hiding this comment.
why
That one of my favorite questions ;)
Sometimes the answer is "tradition", but in this case I think it's readability, as it breaks the indentation.
There also might be some weirdness in Windows where EOL is \r\n if you set git to autocrlf=true, and that changes the strings. I'm so so sorry and a little ashamed for my prefered platform, but then again macOS has .DS_Store files so...
There was a problem hiding this comment.
take your vote i guess
return`${resourceName}:${lineNumber}${sourceLine}${' '.repeat(startPosition)}${'^'.repeat(endPosition-startPosition)}${errorString} at ${trace.join('\n at ')}`;vs
return`${resourceName}:${lineNumber}\n${sourceLine}\n`+' '.repeat(startPosition)+'^'.repeat(endPosition-startPosition)+`\n\n${errorString}\n at ${trace.join('\n at ')}`;There was a problem hiding this comment.
It's probably going to look a bit better if you break at the end of every \n..
There was a problem hiding this comment.
@joyeecheung like this?
return`${resourceName}:${lineNumber}\n${sourceLine}\n`+' '.repeat(startPosition)+'^'.repeat(endPosition-startPosition)+'\n'+'\n'+errorString+'\n'+` at ${trace.join('\n at ')}`;There was a problem hiding this comment.
Maybe (just to reduce the '\n' kruft):
constnumberOfCarrots=endPosition-startPosition;consttraceLines=[`${resourceName}:${lineNumber}`,`${sourceLine}`,' '.repeat(startPosition)+'^'.repeat(numberOfCarrots),'',errorString,
...(trace.map((t)=>` at ${t}`)),];returntraceLines.join('\n');(carrot is funnier than carat)
Also could concat the trace more elegantly:
errorString,];traceLines=traceLines.concat(trace.map((t)=>` at ${t}`))returntraceLines.join('\n');There was a problem hiding this comment.
all of these are equally unreadable and the last one is creating an array just for the purpose of joining it...
i understand the indentation hazard but that's why we have tests right?
There was a problem hiding this comment.
all of these are equally unreadable and the last one is creating an array just for the purpose of joining it...
No strong argument from me... Trying to make the best of a complicated situation.
as for the array, it's probably going to be the last code run by the process, so..
There was a problem hiding this comment.
@devsnek it has been something that we tried to stick to in the whole code base. Not everyone is aware how multi line template strings actually work as people forget that leading spaces actually count. This was an issue in multiple PRs so far. So it's not only about the readability but about correctness as well (not in this specific PR but as a general issue).
Sadly there's no eslint rule to only forbid multi line template strings. We should probably write one to enforce this.
BridgeAR
commented
Nov 4, 2018
I have to compile this on my own and play around with it. If I understand this correct it will from now on always attach the source to the stack (if the user did not override the function). That is great! It would be nice if the error decoration could be expanded to cover multiple line statements fully and not only print the first line of the statement. Besides that it seems like the position indicator is not always correct (I checked some error output), so that should be looked at again. It does not directly seem to impact We definitely have to think about changing the simple assert error message again before this lands since it would otherwise print redundant information. @devsnek please correct me if I am wrong with anything I said here. |
@BridgeAR i think removing it entirely would make sense with this change.
|
603c5da to
069e826Compared2764d5 to
a55c34fCompare9325c95 to
2f00fbfComparenodejs-github-bot
commented
May 16, 2019
devsnek
commented
May 16, 2019
@joyeecheung does the current init code here make sense? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9272abf to
a647319Comparenodejs-github-bot
commented
May 20, 2019
Uh oh!
There was an error while loading. Please reload this page.
ee4d8bd to
73be33eComparenodejs-github-bot
commented
May 21, 2019
Refs https://crbug.com/v8/7848 PR-URL: nodejs#23926 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
devsnek
commented
May 21, 2019
Landed in b046bd1 |
Refs https://crbug.com/v8/7848 PR-URL: #23926 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>




These changes exist for a few reasons:
process.binding('util')to stop node from decorating errors if they want to do their own thing.Closes#21958
/cc @BridgeAR@joyeecheung@bmeck@jdalton@mmarchini@ljharb
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes