fix: log discarded errors across post/upcoming/shows - #46
Open
SpackledJim wants to merge 1 commit into
Open
SpackledJim wants to merge 1 commit into
SpackledJim wants to merge 1 commit into
Conversation
Several catch blocks discarded the underlying error entirely, or only logged a string with no way to see what actually failed: - post.ts: forum post creation failures inside the per-show loop were silently discarded, with no way to diagnose real causes (permissions, rate limits). Added logging of the underlying error. - upcoming.ts: errors were only surfaced if they were an Error instance; anything else fell through silently to a misleading "No shows found" reply, and nothing was ever logged. Now logs the error and always replies with a message. - shows.ts (getAirDate): a date-parsing failure was replaced with a generic "Could not parse air date" message, discarding the original error and the actual date/time/timezone values involved. Now logs both before rethrowing. - shows.ts (checkForAiringEpisodes): the catch block looked like it logged the error, but only passed a string template to console.error and never included the actual error object/stack. Now logs it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S9oMx1pYL6igWuytQyqSTa
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log errors in catch blocks that currently discard them
Commit:
b810a7a—fix: log discarded errors across post/upcoming/showsContext
A
/postfailure replied onlyError creating posts for \tt4158110`, with nothing in the logs. The cause was a missing "Manage Messages" permission, whichcreateForumPost` needs to pin the post. The thread was created before the pin failed, so the show was never saved to the DB, and a retry created a second thread.A review of the codebase's catch blocks found three more that drop error details. Most other catch blocks (
tvdb.ts,commandManager.ts,episodeNotifier.ts,link.ts) already log errors; these changes follow the same pattern.Changes
commands/post.tsconsole.errorwith IMDB IDcommands/upcoming.tsErrorvalues fell through to "No shows found"lib/shows.tsgetAirDatelib/shows.tscheckForAiringEpisodesconsole.errorUser-facing messages are unchanged, except in
upcoming.tswhere non-Errorvalues now return a generic error message instead of "No shows found".Possible follow-up
Handle pin failures separately in
createForumPost, so a post that was created successfully isn't treated as a failure.