mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-02 13:02:00 +08:00
chore(routes): fix no-explicit-any lint/ts error for catch blocks
This commit is contained in:
parent
272d7cd652
commit
e3d0c53d03
@ -33,8 +33,11 @@ async function exec(req: Request) {
|
|||||||
executionResult: result,
|
executionResult: result,
|
||||||
maxEntityChangeId: syncService.getMaxEntityChangeId()
|
maxEntityChangeId: syncService.getMaxEntityChangeId()
|
||||||
};
|
};
|
||||||
} catch (e: any) {
|
} catch (e: unknown) {
|
||||||
return { success: false, error: e.message };
|
return {
|
||||||
|
success: false,
|
||||||
|
error: (e instanceof Error) ? e.message : "Unknown Error"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +56,10 @@ function execute(req: Request) {
|
|||||||
success: true,
|
success: true,
|
||||||
results
|
results
|
||||||
};
|
};
|
||||||
} catch (e: any) {
|
} catch (e: unknown) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: e.message
|
error: (e instanceof Error) ? e.message : "Unknown Error"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,10 @@ async function testSync() {
|
|||||||
syncService.sync();
|
syncService.sync();
|
||||||
|
|
||||||
return { success: true, message: t("test_sync.successful") };
|
return { success: true, message: t("test_sync.successful") };
|
||||||
} catch (e: any) {
|
} catch (e: unknown) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: e.message
|
error: (e instanceof Error) ? e.message : "Unknown Error"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import express from "express";
|
|||||||
import { isDev, isElectron } from "../services/utils.js";
|
import { isDev, isElectron } from "../services/utils.js";
|
||||||
import type serveStatic from "serve-static";
|
import type serveStatic from "serve-static";
|
||||||
|
|
||||||
const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions<express.Response<any, Record<string, any>>>) => {
|
const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions<express.Response<unknown, Record<string, unknown>>>) => {
|
||||||
if (!isDev) {
|
if (!isDev) {
|
||||||
options = {
|
options = {
|
||||||
maxAge: "1y",
|
maxAge: "1y",
|
||||||
|
@ -477,7 +477,7 @@ function route(method: HttpMethod, path: string, middleware: express.Handler[],
|
|||||||
|
|
||||||
if (result?.then) {
|
if (result?.then) {
|
||||||
// promise
|
// promise
|
||||||
result.then((promiseResult: unknown) => handleResponse(resultHandler, req, res, promiseResult, start)).catch((e: any) => handleException(e, method, path, res));
|
result.then((promiseResult: unknown) => handleResponse(resultHandler, req, res, promiseResult, start)).catch((e: unknown) => handleException(e, method, path, res));
|
||||||
} else {
|
} else {
|
||||||
handleResponse(resultHandler, req, res, result, start);
|
handleResponse(resultHandler, req, res, result, start);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user