-
Notifications
You must be signed in to change notification settings - Fork 30k
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
src: use proper errors as coming from StringBytes #14579
Conversation
"readlink", | ||
"Invalid character encoding for link", | ||
*path); | ||
env->isolate()->ThrowException(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return env->isolate()->ThrowException(error);
? The call to rc.ToLocalChecked()
two lines down will fail if you fall through.
Same issue appears a few more times further down in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/node_os.cc
Outdated
@@ -354,7 +354,8 @@ static void GetUserInfo(const FunctionCallbackInfo<Value>& args) { | |||
const int err = uv_os_get_passwd(&pwd); | |||
|
|||
if (err) { | |||
return env->ThrowUVException(err, "uv_os_get_passwd"); | |||
env->ThrowUVException(err, "uv_os_get_passwd"); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stylistic change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed up, this was not intentional
src/node_os.cc
Outdated
uv_os_free_passwd(&pwd); | ||
env->isolate()->ThrowException(error); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: move the .IsEmpty() checks to after the StringBytes::Encode() calls, then you don't have to do the goto jump-around thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
is cleared by StringBytes::Encode()
if the call succeeded… I’ve thought about doing that, would you prefer to change that behaviour? I can see the advantage that would have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I was thinking of guarding the Encode() calls with an error.IsEmpty()
check but that's a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis Done, PTAL!
4951e75
to
84a16b0
Compare
@bnoordhuis Mind taking another look? |
src/node_os.cc
Outdated
@@ -365,6 +365,7 @@ static void GetUserInfo(const FunctionCallbackInfo<Value>& args) { | |||
pwd.username, | |||
encoding, | |||
&error); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mildly unrelated change.
The previous errors were incorrect here, as the code only failed in situations where strings exceeded size limits or an OOM situation was encountered, not for invalid encodings (which aren’t even detected explicitly). Unfortunately, these situations are hard to test for. PR-URL: nodejs#14579 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
84a16b0
to
116447a
Compare
CI: https://ci.nodejs.org/job/node-test-commit/11985/ This should be ready. |
@addaleax ... fyi https://ci.nodejs.org/job/node-test-commit-aix/8108/nodes=aix61-ppc64/console Can you check to see if this failure is related to the change? |
Ugh … a lot of the Linux failures are the same, so, probably? |
Sigh. Yes, also a problem on |
I'm digging in also. :-) This wasn't a problem earlier today so it has to be one of the PRs landed today.... and I can't get to Jenkins... sigh. Will keep trying |
@jasnell I think it’s only 32-bit systems (?) My guess would be Lines 318 to 327 in c6da5c8
I realize that’s kind of my code because it mirrors the HTTP2 one, so … uuh. 😄 |
Heh, okay, I think I got this. |
Um.. that's confusing then :-/ ... the CI was good for that PR even on 32 bit system. What do you have? |
The previous errors were incorrect here, as the code only failed in situations where strings exceeded size limits or an OOM situation was encountered, not for invalid encodings (which aren’t even detected explicitly). Unfortunately, these situations are hard to test for. PR-URL: #14579 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
The previous errors were incorrect here, as the code only failed in situations where strings exceeded size limits or an OOM situation was encountered, not for invalid encodings (which aren’t even detected explicitly). Unfortunately, these situations are hard to test for. PR-URL: nodejs/node#14579 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
The previous errors were incorrect here, as the code only failed in situations where strings exceeded size limits or an OOM situation was encountered, not for invalid encodings (which aren’t even detected explicitly). Unfortunately, these situations are hard to test for. PR-URL: nodejs/node#14579 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
The previous errors were incorrect here, as the code
only failed in situations where strings exceeded size limits or
an OOM situation was encountered, not for invalid encodings
(which aren’t even detected explicitly).
Unfortunately, these situations are hard to test for.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src