fix : AbortError logs
This commit is contained in:
@@ -14,7 +14,7 @@ export const getLichessEval = async (
|
|||||||
): Promise<PositionEval> => {
|
): Promise<PositionEval> => {
|
||||||
try {
|
try {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
const timeoutId = setTimeout(() => controller.abort(), 200);
|
const timeoutId = setTimeout(() => controller.abort("timeout"), 200);
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`https://lichess.org/api/cloud-eval?fen=${fen}&multiPv=${multiPv}`,
|
`https://lichess.org/api/cloud-eval?fen=${fen}&multiPv=${multiPv}`,
|
||||||
{ method: "GET", signal: controller.signal }
|
{ method: "GET", signal: controller.signal }
|
||||||
@@ -52,9 +52,14 @@ export const getLichessEval = async (
|
|||||||
bestMove,
|
bestMove,
|
||||||
lines: linesToKeep,
|
lines: linesToKeep,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (rawError) {
|
||||||
const err = error instanceof Error ? error : new Error("Unknown error");
|
const error =
|
||||||
logErrorToSentry(err, { fen, multiPv });
|
rawError instanceof Error ? rawError : new Error("Unknown error");
|
||||||
|
|
||||||
|
if (error.name !== "AbortError") {
|
||||||
|
logErrorToSentry(error, { fen, multiPv });
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
bestMove: "",
|
bestMove: "",
|
||||||
lines: [],
|
lines: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user