Uh oh!
There was an error while loading. Please reload this page.
repl: fix error message - #13733
Conversation
Side note: There is an error code |
BridgeAR
commented
Jun 17, 2017
Good catch. It is indeed not used and it is very similar to the |
tniessen
commented
Jun 18, 2017
I am actually not too sure whether this is correct as it is. Considering that |
I think what @tniessen says makes sense (but tbh I’ve never actually seen this error happen in the wild) |
BridgeAR
commented
Jun 21, 2017
I changed the error to |
tniessen
commented
Jun 21, 2017
I think this should be semver-major due to the changed error code. @jasnell Are you okay with this? Gonna land it then. |
Wait, this should not be merged as is. The error is actually completely obsolete and it does not matter what is thrown as the catch block is going to catch the error and return a new and different one that has nothing to do with this error. I'm thinking about fixing it like this: try{// Pre-v3.0, repl history was stored as JSON.// Try and convert it to line separated history.constoldReplJSONHistory=fs.readFileSync(oldHistoryPath,'utf8');// Only attempt to use the history if there was any.if(oldReplJSONHistory)repl.history=JSON.parse(oldReplJSONHistory);}catch(err){returnready(newerrors.Error('ERR_PARSE_HISTORY_DATA',oldHistoryPath));}if(!Array.isArray(repl.history)){returnready(newerrors.TypeError('ERR_INVALID_REPL_HISTORY',typeofrepl.history));}repl.history=repl.history.slice(0,repl.historySize);This also needs tests as they are missing and lead to the error in the first place. What do you all think? Note to myself: check #2449 |
tniessen
commented
Jun 21, 2017
You are right, I did not even look at that before. Knowing this it makes even less sense why there is |
BridgeAR
commented
Jun 22, 2017
I fixed the error handling in a way that I expect was originally meant. I am not a big fan of it though and while working on it I thought it might be worth thinking about simple removing the old history file, so I opened an alternative: #13876 |
BridgeAR
commented
Jun 26, 2017
As suggested in #13876 the way would be to make a end of life deprecation and then remove this part overall. But until then this fix could go into the code base and I think it could even be backported as well and is a semver-patch. So PTAL |
tniessen
commented
Jun 28, 2017
CI: https://ci.nodejs.org/job/node-test-pull-request/8849/ @jasnell@lpinca@cjihrig There have been some major changes since your approvals, could you PTAL and just give me a thumb up if you are okay with landing this as it is? |
cjihrig
commented
Jun 28, 2017
This has conflicts. |
BridgeAR
commented
Jun 29, 2017
Rebased |
lpinca
commented
Jun 29, 2017
There was a problem hiding this comment.
Nit: why not putting this in the if branch where the try...catch is defined?
There was a problem hiding this comment.
Nit: I don't think this is a problem but this message is now displayed after the conversion is actually done.
There was a problem hiding this comment.
This was intentional as the message would otherwise be visible even though the conversion did not occur due to e.g. ENOENT or a parsing error etc.
There was a problem hiding this comment.
Yes, I'm fine with this it's just that "converting" suggests that conversion is still happening so it makes sense to display it even if there is a parse error.
I would use "Converted" now.
BridgeAR
commented
Jun 29, 2017
By the way: IMHO this should not be semver-major (if by any means, then because of the change from |
tniessen
commented
Jun 30, 2017
CI: https://ci.nodejs.org/job/node-test-pull-request/8885/ Please fix CI failures. |
BridgeAR
commented
Jun 30, 2017
Fixed |
New CI: https://ci.nodejs.org/job/node-test-pull-request/8890/ I will land this after giving @nodejs/ctc some time to review and decide semver-ity (even though - technically - two CTC members have already approved). |
As far as I can tell this only affects the REPL, as in, the application built into Node, not the public |
PR-URL: nodejs#13733 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
addaleax
commented
Jul 3, 2017
This doesn’t land cleanly on 8.x; if you can, please follow the guide and raise a backport PR, if you don’t think it’s worth it (or wrong) let me know and we’ll add the |
PR-URL: nodejs#13733 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
BridgeAR
commented
Jul 20, 2017
@addaleax I opened a backport to 8.x |
MylesBorins
commented
Aug 16, 2017
Should this be backported to |
BridgeAR
commented
Dec 11, 2017
I do not think that it is worth backporting. So I changed the label accordingly. |
While looking at the
ERR_INVALID_ARG_TYPEerrors, I stumbled across this one. The property name should be passed to the internal error instead of the type.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
repl