Comparing version 3.15.1 to 3.15.2
@@ -812,2 +812,20 @@ "use strict"; | ||
})().catch(reject)).catch((e) => { | ||
if (!e.code && e.stack?.split('\n')[1]?.includes('node:internal/tls/secure-context')) { | ||
// OpenSSL can throw all sorts of weird & wonderful errors here, and rarely exposes a | ||
// useful error code from them. To handle that, we try to detect the most common cases, | ||
// notable including the useless but common 'unsupported' error that covers all | ||
// OpenSSL-unsupported (e.g. legacy) configurations. | ||
let tlsErrorTag; | ||
if (e.message === 'unsupported') { | ||
e.code = 'ERR_TLS_CONTEXT_UNSUPPORTED'; | ||
tlsErrorTag = 'context-unsupported'; | ||
e.message = 'Unsupported TLS configuration'; | ||
} | ||
else { | ||
e.code = 'ERR_TLS_CONTEXT_UNKNOWN'; | ||
tlsErrorTag = 'context-unknown'; | ||
e.message = `TLS context error: ${e.message}`; | ||
} | ||
clientRes.tags.push(`passthrough-tls-error:${tlsErrorTag}`); | ||
} | ||
// All errors anywhere above (thrown or from explicit reject()) should end up here. | ||
@@ -814,0 +832,0 @@ // We tag the response with the error code, for debugging from events: |
{ | ||
"name": "mockttp", | ||
"version": "3.15.1", | ||
"version": "3.15.2", | ||
"description": "Mock HTTP server for testing HTTP clients and stubbing webservices", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -1130,2 +1130,22 @@ import _ = require('lodash'); | ||
).catch((e: ErrorLike) => { | ||
if (!e.code && e.stack?.split('\n')[1]?.includes('node:internal/tls/secure-context')) { | ||
// OpenSSL can throw all sorts of weird & wonderful errors here, and rarely exposes a | ||
// useful error code from them. To handle that, we try to detect the most common cases, | ||
// notable including the useless but common 'unsupported' error that covers all | ||
// OpenSSL-unsupported (e.g. legacy) configurations. | ||
let tlsErrorTag: string; | ||
if (e.message === 'unsupported') { | ||
e.code = 'ERR_TLS_CONTEXT_UNSUPPORTED'; | ||
tlsErrorTag = 'context-unsupported'; | ||
e.message = 'Unsupported TLS configuration'; | ||
} else { | ||
e.code = 'ERR_TLS_CONTEXT_UNKNOWN'; | ||
tlsErrorTag = 'context-unknown'; | ||
e.message = `TLS context error: ${e.message}`; | ||
} | ||
clientRes.tags.push(`passthrough-tls-error:${tlsErrorTag}`); | ||
} | ||
// All errors anywhere above (thrown or from explicit reject()) should end up here. | ||
@@ -1132,0 +1152,0 @@ |
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
1549297
26443