mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-01 02:01:33 +08:00
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
This commit is contained in:
parent
9eeedc827c
commit
9a8a27c02c
@ -209,7 +209,7 @@ export function timeLimit<T>(promise: Promise<T>, limitMs: number, errorMessage?
|
|||||||
}
|
}
|
||||||
|
|
||||||
// better stack trace if created outside of promise
|
// 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) => {
|
return new Promise((res, rej) => {
|
||||||
let resolved = false;
|
let resolved = false;
|
||||||
@ -224,7 +224,7 @@ export function timeLimit<T>(promise: Promise<T>, limitMs: number, errorMessage?
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
rej(error);
|
rej(errorTimeLimit);
|
||||||
}
|
}
|
||||||
}, limitMs);
|
}, limitMs);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user