Refractoring Stage 5 Completed the IPC feature-grouping step.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
function isConnectivityFailure(error) {
|
||||
const networkCodes = new Set(['ECONNRESET', 'ECONNREFUSED', 'ENOTFOUND', 'EAI_AGAIN', 'ETIMEDOUT', 'ENETUNREACH', 'EHOSTUNREACH', 'ESOCKET']);
|
||||
for (let current = error; current; current = current.cause) {
|
||||
if (networkCodes.has(current.code)) return true;
|
||||
if (/network is unreachable|connection timed out|connection refused|could not resolve|socket hang up/i.test(current.message || '')) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = { isConnectivityFailure };
|
||||
Reference in New Issue
Block a user