Skip to content

Build your personal knowledge base with Trilium Notes

refactor(server/utils): avoid same variable name for error in timeLimit

Panagiotis Papadopoulos9a8a27c02c22
diff --git a/src/services/utils.ts b/src/services/utils.ts
index 67c415f9f7..c9636f16f7 100644
--- a/src/services/utils.ts
+++ b/src/services/utils.ts
@@ -209,7 +209,7 @@ export function timeLimit<T>(promise: Promise<T>, 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<T>(promise: Promise<T>, limitMs: number, errorMessage?
setTimeout(() => {
if (!resolved) {
- rej(error);
+ rej(errorTimeLimit);
}
}, limitMs);
});