fix: improve error logging
Cloudflare doesn't log causes, only the messages so splitting the logs in to 2
This commit is contained in:
@@ -46,11 +46,9 @@ export async function getEpisodesFromAnify(
|
||||
abortController.abort("Loading episodes from Anify timed out");
|
||||
}
|
||||
console.error(
|
||||
new Error(
|
||||
`Error trying to load episodes from anify; aniListId: ${aniListId}`,
|
||||
{ cause: e },
|
||||
),
|
||||
`Error trying to load episodes from anify; aniListId: ${aniListId}`,
|
||||
);
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
if (!response || response.length === 0) {
|
||||
|
||||
@@ -68,11 +68,9 @@ export async function getEpisodesFromAniwatch(
|
||||
}
|
||||
|
||||
console.error(
|
||||
new Error(
|
||||
`Error trying to load episodes from aniwatch; aniListId: ${aniListId}`,
|
||||
{ cause: error },
|
||||
),
|
||||
`Error trying to load episodes from aniwatch; aniListId: ${aniListId}`,
|
||||
);
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -29,11 +29,9 @@ export async function getEpisodesFromConsumet(
|
||||
} catch (error: any) {
|
||||
if (!error.message.includes("failed with status code")) {
|
||||
console.error(
|
||||
new Error(
|
||||
`Error trying to load episodes from consumet; aniListId: ${aniListId}`,
|
||||
{ cause: error },
|
||||
),
|
||||
`Error trying to load episodes from consumet; aniListId: ${aniListId}`,
|
||||
);
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,6 @@ export async function markEpisodeAsWatched(
|
||||
) {
|
||||
const client = new GraphQLClient("https://graphql.anilist.co/");
|
||||
|
||||
console.log(aniListToken);
|
||||
console.log(
|
||||
typeof aniListToken,
|
||||
titleId,
|
||||
typeof titleId,
|
||||
episodeNumber,
|
||||
typeof episodeNumber,
|
||||
markTitleAsComplete,
|
||||
);
|
||||
const mutation = markTitleAsComplete
|
||||
? client.request(
|
||||
MarkTitleAsWatchedMutation,
|
||||
|
||||
@@ -94,9 +94,8 @@ app.openapi(route, async (c) => {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
new Error("Failed to mark episode as watched", { cause: error }),
|
||||
);
|
||||
console.error("Failed to mark episode as watched");
|
||||
console.error(error);
|
||||
return c.json(ErrorResponse, { status: 500 });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user