fix : log lichess error

This commit is contained in:
GuillaumeSD
2024-12-30 00:22:34 +01:00
parent bc66464e4d
commit be4456825c

View File

@@ -53,7 +53,7 @@ export const getLichessEval = async (
lines: linesToKeep,
};
} catch (error) {
if (error !== "timeout") {
if (!isAbortError(error)) {
logErrorToSentry(error, { fen, multiPv });
}
@@ -64,6 +64,11 @@ export const getLichessEval = async (
}
};
const isAbortError = (error: unknown): boolean =>
error === "timeout" ||
((error instanceof Error || error instanceof DOMException) &&
(error.name === "AbortError" || error.message === "timeout"));
export const getLichessUserRecentGames = async (
username: string
): Promise<LichessGame[]> => {