Skip to content

Commit fa8a54d

Browse files
committed
Code refactor
1 parent 286a6b2 commit fa8a54d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/nodejs-common/util.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -915,14 +915,13 @@ export class Util {
915915
if (err) {
916916
const lowerCaseMessage = err.message.toLowerCase();
917917
const isTLsTimeoutOrConnReset =
918-
lowerCaseMessage.includes('tls handshake') ||
919-
lowerCaseMessage.includes('timed out') ||
920-
lowerCaseMessage.includes('etimedout') ||
921-
lowerCaseMessage.includes('econnreset');
922-
if (isTLsTimeoutOrConnReset) {
923-
const timeOutError = new Error(
924-
'Request or TLS handshake timed out. This may be due to CPU starvation or a temporary network issue.'
918+
/tls handshake|timed out|etimedout|econnreset/.test(
919+
lowerCaseMessage
925920
);
921+
if (isTLsTimeoutOrConnReset) {
922+
const TLS_TIMEOUT_ERROR_MESSAGE =
923+
'Request or TLS handshake timed out. This may be due to CPU starvation or a temporary network issue.';
924+
const timeOutError = new Error(TLS_TIMEOUT_ERROR_MESSAGE);
926925
err = timeOutError;
927926
}
928927
}

0 commit comments

Comments
 (0)