Skip to content

Commit 4755b07

Browse files
nlfwraithgar
authored andcommitted
fix: friendlier errors for ERR_SOCKET_TIMEOUT
PR-URL: #3498 Credit: @nlf Close: #3498 Reviewed-by: @wraithgar
1 parent 339145f commit 4755b07

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

lib/utils/error-message.js

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ module.exports = (er, npm) => {
269269
case 'ECONNRESET':
270270
case 'ENOTFOUND':
271271
case 'ETIMEDOUT':
272+
case 'ERR_SOCKET_TIMEOUT':
272273
case 'EAI_FAIL':
273274
short.push(['network', er.message])
274275
detail.push([

tap-snapshots/test/lib/utils/error-message.js.test.cjs

+23
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,29 @@ Object {
12891289
}
12901290
`
12911291

1292+
exports[`test/lib/utils/error-message.js TAP just simple messages > must match snapshot 23`] = `
1293+
Object {
1294+
"detail": Array [
1295+
Array [
1296+
"network",
1297+
String(
1298+
This is a problem related to network connectivity.
1299+
In most cases you are behind a proxy or have bad network settings.
1300+
1301+
If you are behind a proxy, please make sure that the
1302+
'proxy' config is set properly. See: 'npm help config'
1303+
),
1304+
],
1305+
],
1306+
"summary": Array [
1307+
Array [
1308+
"network",
1309+
"foo",
1310+
],
1311+
],
1312+
}
1313+
`
1314+
12921315
exports[`test/lib/utils/error-message.js TAP just simple messages > must match snapshot 3`] = `
12931316
Object {
12941317
"detail": Array [

test/lib/utils/error-message.js

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ t.test('just simple messages', t => {
9797
'ETOOMANYARGS',
9898
'ETARGET',
9999
'E403',
100+
'ERR_SOCKET_TIMEOUT',
100101
]
101102
t.plan(codes.length)
102103
codes.forEach(code => {

0 commit comments

Comments
 (0)