Skip to content
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

fix: friendlier errors for ERR_SOCKET_TIMEOUT #3498

Merged
merged 1 commit into from Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/utils/error-message.js
Expand Up @@ -269,6 +269,7 @@ module.exports = (er, npm) => {
case 'ECONNRESET':
case 'ENOTFOUND':
case 'ETIMEDOUT':
case 'ERR_SOCKET_TIMEOUT':
case 'EAI_FAIL':
short.push(['network', er.message])
detail.push([
Expand Down
23 changes: 23 additions & 0 deletions tap-snapshots/test/lib/utils/error-message.js.test.cjs
Expand Up @@ -1289,6 +1289,29 @@ Object {
}
`

exports[`test/lib/utils/error-message.js TAP just simple messages > must match snapshot 23`] = `
Object {
"detail": Array [
Array [
"network",
String(
This is a problem related to network connectivity.
In most cases you are behind a proxy or have bad network settings.

If you are behind a proxy, please make sure that the
'proxy' config is set properly. See: 'npm help config'
),
],
],
"summary": Array [
Array [
"network",
"foo",
],
],
}
`

exports[`test/lib/utils/error-message.js TAP just simple messages > must match snapshot 3`] = `
Object {
"detail": Array [
Expand Down
1 change: 1 addition & 0 deletions test/lib/utils/error-message.js
Expand Up @@ -97,6 +97,7 @@ t.test('just simple messages', t => {
'ETOOMANYARGS',
'ETARGET',
'E403',
'ERR_SOCKET_TIMEOUT',
]
t.plan(codes.length)
codes.forEach(code => {
Expand Down