From 9a8a27c02c2226d4fc1ed216875aa07433fd5f22 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Fri, 31 Jan 2025 07:43:01 +0100 Subject: [PATCH] refactor(server/utils): avoid same variable name for error in timeLimit rename the error created in timeLimit to `errorTimeLimit` to differentiate it from the error that is caught inside the promise makes it a bit easier to quickly distinguish these --- src/services/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/utils.ts b/src/services/utils.ts index 67c415f9f..c9636f16f 100644 --- a/src/services/utils.ts +++ b/src/services/utils.ts @@ -209,7 +209,7 @@ export function timeLimit(promise: Promise, limitMs: number, errorMessage? } // better stack trace if created outside of promise - const error = new Error(errorMessage || `Process exceeded time limit ${limitMs}`); + const errorTimeLimit = new Error(errorMessage || `Process exceeded time limit ${limitMs}`); return new Promise((res, rej) => { let resolved = false; @@ -224,7 +224,7 @@ export function timeLimit(promise: Promise, limitMs: number, errorMessage? setTimeout(() => { if (!resolved) { - rej(error); + rej(errorTimeLimit); } }, limitMs); });