mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-22 15:33:12 +09:00
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:
1 parent
afc1d35668
commit
389004d652
8 files changed
+32
-32
No files matched your search
@@ -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`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user