fix(reliability): distinguish Discord 404 from auth errors in reactions
The catch-all in checkReactions() silently swallowed auth failures (401/403), making them indistinguishable from "no reaction yet". Now: - 404: expected (no reactions for this emoji), continue - 401/403: re-thrown so the poll loop surfaces the auth failure - Other errors: best-effort skip (rate limits, network) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
003cb44007
commit
cd813ddded
1 changed files with 7 additions and 2 deletions
|
|
@ -76,8 +76,13 @@ export class DiscordAdapter implements ChannelAdapter {
|
|||
const humanUsers = users.filter((u: { id: string }) => u.id !== this.botUserId);
|
||||
if (humanUsers.length > 0) reactions.push({ emoji, count: humanUsers.length });
|
||||
}
|
||||
} catch {
|
||||
// ignore missing reaction
|
||||
} catch (err) {
|
||||
const msg = String((err as Error).message ?? "");
|
||||
// 404 = no reactions for this emoji — expected, continue
|
||||
if (msg.includes("HTTP 404")) continue;
|
||||
// 401/403 = auth failure — surface to caller so it can fail the poll
|
||||
if (msg.includes("HTTP 401") || msg.includes("HTTP 403")) throw err;
|
||||
// Other errors (rate limit, network) — skip this emoji, best-effort
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue