Replace RequestError with the HTTP-style error classes

clusterio#999 removed RequestError. Handlers now throw NotFoundError,
ValidationError, ConflictError or UnavailableError, and exp_auto_restart
treats any ClientError from the host as a final refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-28 23:43:25 +00:00
1 parent afc1d35668
commit 389004d652
8 files changed
+32 -32

No files matched your search

+2 -2
View File
@@ -385,7 +385,7 @@ export class ControllerPlugin {
const entry = this.codes.get(code);
const session = entry ? this.sessions.get(entry.sessionId) : undefined;
if (!entry || !session || entry.expiresMs < Date.now()) {
throw new lib.RequestError(
throw new lib.ValidationError(
`This code is invalid or has expired, get a new one from ${this.controller.getControllerUrl()}`
);
}
@@ -403,7 +403,7 @@ export class ControllerPlugin {
const alreadyLinked = existing?.factorioNames.some(linked => linked.toLowerCase() === name);
const maxAccounts = this.controller.config.get("exp_discord_auth.max_accounts");
if (!alreadyLinked && (existing?.factorioNames.length ?? 0) >= maxAccounts) {
throw new lib.RequestError(
throw new lib.ConflictError(
`${discordUser.name} already has ${maxAccounts} Factorio accounts linked, unlink one first`
);
}