mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01: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:
		@@ -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);
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user