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;