diff --git a/src/commands/post.ts b/src/commands/post.ts index 8b81dc0..2916447 100644 --- a/src/commands/post.ts +++ b/src/commands/post.ts @@ -131,6 +131,7 @@ export const command: CommandV2 = { post: newPost, }) } catch (error) { + console.error(`Error creating post for ${imdbId}:`, error) messages.push(`Error creating post for \`${imdbId}\``) seriesList.delete(imdbId) } diff --git a/src/commands/upcoming.ts b/src/commands/upcoming.ts index f5adfec..075359e 100644 --- a/src/commands/upcoming.ts +++ b/src/commands/upcoming.ts @@ -60,9 +60,11 @@ export const command: CommandV2 = { break } } catch (error) { - if (error instanceof Error) { - return await interaction.editReply(error.message) - } + console.error(`Error fetching upcoming episodes (${subCommand}):`, error) + const message = error instanceof Error + ? error.message + : "An unexpected error occurred while fetching upcoming episodes" + return await interaction.editReply(message) } if (s == null || s.length === 0) { diff --git a/src/lib/shows.ts b/src/lib/shows.ts index 0350cf9..6988a7d 100644 --- a/src/lib/shows.ts +++ b/src/lib/shows.ts @@ -28,6 +28,10 @@ function getAirDate( timezone, ) } catch (error) { + console.error( + `Could not parse air date (dateStr=${dateStr}, timeStr=${timeStr}, timezone=${timezone}):`, + error, + ) throw new Error("Could not parse air date") } } @@ -114,7 +118,7 @@ export async function checkForAiringEpisodes(): Promise { try { await updateEpisodes(show.imdbId, show.tvdbId) } catch (error) { - console.error(`Error updating episodes for ${show.name} (${show.imdbId})`) + console.error(`Error updating episodes for ${show.name} (${show.imdbId}):`, error) } }