-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 UV_EINVAL instead of EINVAL in udp_wrap #15444
Conversation
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.
LGTM. A test would be nice if possible.
Good point, added a test for this. |
type: Error, | ||
message: new RegExp('^Could not get or set buffer' + | ||
' size: Error: EINVAL: invalid argument,' + | ||
' uv_' + type + '_buffer_size$') |
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.
Nit: I believe a string (instead of a regex) is enough to get exact matching here. You might want to use a template string instead of concatenation, I think we agreed on that preference.
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.
I actually used a template for this but the linter complained which is why I changed it. I'll take another look though.
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.
We usually use templates, except if the line becomes too long, in that case you can concatenate templates and string literals:
'Could not get or set buffer size: Error: EINVAL: ' +
`invalid argument, uv_${type}_buffer_size`
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.
Thanks, updated now.
const errorObj = { | ||
code: 'ERR_SOCKET_BUFFER_SIZE', | ||
type: Error, | ||
message: `Could not get or set buffer size: Error: EINVAL: invalid argument, uv_${type}_buffer_size` // eslint-disable-line max-len |
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.
I think both of the long lines in this file could be handled without disabling the ESLint rule.
This failed CI across the board. |
@jasnell Thanks for the heads up. I see the problem and will take a closer look. (I'm at a f2f this week so response times might not be that good) |
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL.
ce843f2
to
b87360c
Compare
@danbev seems like the CI is green now. Is this ready to land? |
Looking into this I found won't work without
Yep, it is good to go now. I can land it later this evening or tomorrow. |
Yep, it is good to go now. I can land it later this evening or tomorrow. |
@danbev top |
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL. PR-URL: nodejs#15444 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in f4899ac |
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL. PR-URL: nodejs/node#15444 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL. PR-URL: #15444 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL. PR-URL: #15444 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL. PR-URL: #15444 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL. PR-URL: #15444 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Currently if the buffer size exceeds the maximum int size the following error will be thrown: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: Unknown system error 22: Unknown system error 22, uv_recv_buffer_size at bufferSize (dgram.js:180:11) It looks like perhaps UV_EINVAL was intended to give the following error message instead: dgram.js:180 throw new errors.Error('ERR_SOCKET_BUFFER_SIZE', e); ^ Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer size: Error: EINVAL: invalid argument, uv_recv_buffer_size at bufferSize (dgram.js:180:11) This commit changes EINVAL to use UV_EINVAL. PR-URL: #15444 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Should this be backported to |
Currently if the buffer size exceeds the maximum int size the following
error will be thrown:
It looks like perhaps UV_EINVAL was intended to give the following error
message instead:
This commit changes EINVAL to use UV_EINVAL.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src