mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-21 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
@@ -147,7 +147,7 @@ export class ControllerPlugin {
|
||||
async handleRoleMetaUpdateRequest(request: messages.RoleMetaUpdateRequest) {
|
||||
const meta = request.meta;
|
||||
if (!this.controller.roles.has(meta.id)) {
|
||||
throw new lib.RequestError(`Role with ID ${meta.id} does not exist`);
|
||||
throw new lib.NotFoundError(`Role with ID ${meta.id} does not exist`);
|
||||
}
|
||||
|
||||
this.roleMeta.set(meta);
|
||||
@@ -248,12 +248,12 @@ export class ControllerPlugin {
|
||||
async handleAssignmentUpdateRequest(request: messages.AssignmentUpdateRequest) {
|
||||
const user = this.controller.users.getByNameMutable(request.name);
|
||||
if (!user) {
|
||||
throw new lib.RequestError(`User '${request.name}' does not exist`);
|
||||
throw new lib.NotFoundError(`User '${request.name}' does not exist`);
|
||||
}
|
||||
|
||||
for (const roleId of [...request.assign, ...request.unassign]) {
|
||||
if (!this.controller.roles.has(roleId)) {
|
||||
throw new lib.RequestError(`Role with ID ${roleId} does not exist`);
|
||||
throw new lib.NotFoundError(`Role with ID ${roleId} does not exist`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user