@cardano-sdk/util
Advanced tools
Comparing version 0.12.0 to 0.12.1
@@ -1,3 +0,2 @@ | ||
export declare const connectionErrorCodes: string[]; | ||
export declare const isConnectionError: (error: any) => boolean; | ||
//# sourceMappingURL=network.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isConnectionError = exports.connectionErrorCodes = void 0; | ||
exports.connectionErrorCodes = [ | ||
exports.isConnectionError = void 0; | ||
const connectionErrorCodes = new Set([ | ||
'ETIMEDOUT', | ||
@@ -11,13 +11,14 @@ 'ECONNRESET', | ||
'ENETUNREACH', | ||
'EAI_AGAIN', | ||
'WebSocket is closed' | ||
]; | ||
'EAI_AGAIN' | ||
]); | ||
const connectionErrorNames = new Set(['WebSocketClosed', 'ServerNotReady']); | ||
const isConnectionError = (error) => { | ||
if ((error?.code && exports.connectionErrorCodes.includes(error.code)) || | ||
(error?.message && exports.connectionErrorCodes.some((err) => error.message.includes(err)))) { | ||
if (!error || typeof error !== 'object') | ||
return false; | ||
if ((error?.name && connectionErrorNames.has(error.name)) || (error?.code && connectionErrorCodes.has(error.code))) { | ||
return true; | ||
} | ||
return false; | ||
return (0, exports.isConnectionError)(error.innerError); | ||
}; | ||
exports.isConnectionError = isConnectionError; | ||
//# sourceMappingURL=network.js.map |
@@ -1,3 +0,2 @@ | ||
export declare const connectionErrorCodes: string[]; | ||
export declare const isConnectionError: (error: any) => boolean; | ||
//# sourceMappingURL=network.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const connectionErrorCodes = [ | ||
const connectionErrorCodes = new Set([ | ||
'ETIMEDOUT', | ||
@@ -8,12 +8,13 @@ 'ECONNRESET', | ||
'ENETUNREACH', | ||
'EAI_AGAIN', | ||
'WebSocket is closed' | ||
]; | ||
'EAI_AGAIN' | ||
]); | ||
const connectionErrorNames = new Set(['WebSocketClosed', 'ServerNotReady']); | ||
export const isConnectionError = (error) => { | ||
if ((error?.code && connectionErrorCodes.includes(error.code)) || | ||
(error?.message && connectionErrorCodes.some((err) => error.message.includes(err)))) { | ||
if (!error || typeof error !== 'object') | ||
return false; | ||
if ((error?.name && connectionErrorNames.has(error.name)) || (error?.code && connectionErrorCodes.has(error.code))) { | ||
return true; | ||
} | ||
return false; | ||
return isConnectionError(error.innerError); | ||
}; | ||
//# sourceMappingURL=network.js.map |
{ | ||
"name": "@cardano-sdk/util", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "General, not cardano-specific utils", | ||
@@ -65,3 +65,3 @@ "engines": { | ||
], | ||
"gitHead": "46029ae65c25ce6cfef394249c7ff5a32259757f" | ||
"gitHead": "13adbccfb323611b1972ccc7a5498a033ea5fcc5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
406611