mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-30 17:41:32 +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
|
||||
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);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user