fix: standardize error classes in shared service modules

Replace raw `Error` with `UserError` for user-facing conditions (invalid trade state, user not found, permission/channel type checks) and `SystemError` for internal failures (DB insert failures, external API errors, missing config). Improves Discord UX by ensuring user-facing errors are surfaced cleanly via withCommandErrorHandling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
syntaxbullet
2026-03-18 12:51:16 +01:00
parent 22e446ff28
commit a96c6caa49
8 changed files with 32 additions and 27 deletions

View File

@@ -96,7 +96,7 @@ export const economyService = {
});
if (!user) {
throw new Error("User not found");
throw new UserError("User not found");
}
let streak = (user.dailyStreak || 0) + 1;