feat: add more error handling

This commit is contained in:
2024-06-07 23:13:30 -04:00
parent 6fd2cc4feb
commit c35c9b9e09
9 changed files with 71 additions and 66 deletions

View File

@@ -28,5 +28,12 @@ export async function fetchTitleFromAnilist(
return client
.request(GetTitleQuery, { id }, headers)
.then((data) => data?.Media ?? undefined);
.then((data) => data?.Media ?? undefined)
.catch((error) => {
if (error.message.includes("Not Found")) {
return undefined;
}
throw error;
});
}