Skip to content

Commit

Permalink
Throw a better error for an untracked message in the server suggestio…
Browse files Browse the repository at this point in the history
…n dashboard
  • Loading branch information
jeremy-rifkin committed Nov 9, 2024
1 parent 8b0dd1c commit 054315a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/server-suggestion-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,11 @@ export default class ServerSuggestionTracker extends BotComponent {
// find and delete this.wheatley.database entry
const suggestion_id = await this.reverse_lookup(message.id);
if (suggestion_id == null) {
throw 0; // untracked - this is an internal error or a race condition
// untracked - this is an internal error or a race condition
throw Error(
"Internal error in server suggestion tracker, most likely a race condition while " +
"handling on_message_delete",
);
} else {
M.info(
"server_suggestion tracker state recovery: Manual status delete",
Expand Down Expand Up @@ -501,7 +505,11 @@ export default class ServerSuggestionTracker extends BotComponent {
// expensive-ish but this will be rare
const suggestion_id = await this.reverse_lookup(message.id);
if (suggestion_id == null) {
throw 0; // untracked - this is an internal error or a race condition
// untracked - this is an internal error or a race condition
throw Error(
"Internal error in server suggestion tracker, most likely a race condition while " +
"handling on_reaction_add",
);
} else {
// lock the status message
// NOTE: Assuming no identical snowflakes between channels, this should be pretty safe though
Expand Down

0 comments on commit 054315a

Please sign in to comment.