@snyk/code-client
Advanced tools
Comparing version 4.5.1 to 4.5.2
@@ -43,3 +43,2 @@ export declare const MAX_PAYLOAD: number; | ||
ENOTFOUND: ErrorCodes; | ||
EADDRNOTAVAIL: ErrorCodes; | ||
}; | ||
@@ -46,0 +45,0 @@ export declare const DEFAULT_ERROR_MESSAGES: { |
@@ -49,3 +49,2 @@ "use strict"; | ||
ENOTFOUND: ErrorCodes.dnsNotFound, | ||
EADDRNOTAVAIL: ErrorCodes.dnsNotFound, // happens when DNS cannot resolve the IPv6 | ||
}; | ||
@@ -52,0 +51,0 @@ exports.DEFAULT_ERROR_MESSAGES = { |
@@ -63,3 +63,3 @@ "use strict"; | ||
}, 0); | ||
const ipv6Incompatible = res.errorCode === constants_1.ErrorCodes.dnsNotFound; | ||
const ipv6Incompatible = res.error; | ||
return ipv6Incompatible ? undefined : family; | ||
@@ -66,0 +66,0 @@ } |
@@ -24,4 +24,5 @@ /// <reference types="node" /> | ||
errorCode: number; | ||
error: Error | undefined; | ||
}; | ||
export declare function makeRequest<T = void>(payload: Payload, attempts?: number): Promise<SuccessResponse<T> | FailedResponse>; | ||
export {}; |
@@ -73,2 +73,3 @@ "use strict"; | ||
let errorCode; | ||
let error; | ||
let response; | ||
@@ -84,2 +85,3 @@ try { | ||
catch (err) { | ||
error = err; // do not swallow the error, pass further to the caller instead | ||
errorCode = constants_1.NETWORK_ERRORS[err.code || err.errno]; | ||
@@ -103,8 +105,8 @@ emitter_1.emitter.apiRequestLog(`Requested url --> ${url} | error --> ${err}`); | ||
attempts = 0; | ||
return { success: false, errorCode }; | ||
return { success: false, errorCode, error }; | ||
} | ||
} while (attempts > 0); | ||
return { success: false, errorCode: constants_1.ErrorCodes.serviceUnavailable }; | ||
return { success: false, errorCode: constants_1.ErrorCodes.serviceUnavailable, error: undefined }; | ||
} | ||
exports.makeRequest = makeRequest; | ||
//# sourceMappingURL=needle.js.map |
@@ -81,3 +81,3 @@ { | ||
}, | ||
"version": "4.5.1" | ||
"version": "4.5.2" | ||
} |
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
129010
1796