From ecff560480f5922cda8dafc91a3e66084a99f6e6 Mon Sep 17 00:00:00 2001 From: ProgrammerIn-wonderland <3838shah@gmail.com> Date: Fri, 5 Sep 2025 20:26:39 -0400 Subject: [PATCH] fix: Use APIErrror.create in place of newAPIError --- src/backend/src/services/EntriService.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/src/services/EntriService.js b/src/backend/src/services/EntriService.js index 1cbb415b4..842d07669 100644 --- a/src/backend/src/services/EntriService.js +++ b/src/backend/src/services/EntriService.js @@ -112,7 +112,7 @@ class EntriService extends BaseService { }); if (exists) { - throw new APIError(409, "already_in_use", null, {what: "domain", value: domain}); + throw APIError.create("already_in_use", null, {what: "domain", value: domain}); } @@ -182,14 +182,14 @@ class EntriService extends BaseService { }, async deleteMapping({domain}) { if (domain.startsWith("in-progress")) - throw new APIError(400, 'field_invalid', null, {key: "domain", expected: 'valid domain'}); + throw APIError.create('field_invalid', null, {key: "domain", expected: 'valid domain'}); /** @type {import("../om/entitystorage/SubdomainES")} */ const es_subdomain = this.services.get('es:subdomain'); const row = (await es_subdomain.select({ predicate: new Eq({ key: "domain", value: domain }) }))[0] || (await es_subdomain.select({ predicate: new Eq({ key: "domain", value: "in-progress:" + domain }) }))[0]; if (!row) { - throw new APIError(403, 'forbidden', null, {}); + throw APIError.create('forbidden', null, {}); } let inProgress = false;