Revert "feat(api): better errors and documentation"

This commit is contained in:
Maidul Islam
2024-09-27 17:25:11 -04:00
committed by GitHub
parent d430293c66
commit 4090c894fc
107 changed files with 854 additions and 979 deletions
+5 -5
View File
@@ -14,7 +14,7 @@ import { getConfig } from "@app/lib/config/env";
import { randomSecureBytes } from "@app/lib/crypto";
import { symmetricCipherService, SymmetricEncryption } from "@app/lib/crypto/cipher";
import { generateHash } from "@app/lib/crypto/encryption";
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { BadRequestError, NotFoundError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
import { alphaNumericNanoId } from "@app/lib/nanoid";
@@ -105,7 +105,7 @@ export const kmsServiceFactory = ({
const deleteInternalKms = async (kmsId: string, orgId: string, tx?: Knex) => {
const kms = await kmsDAL.findByIdWithAssociatedKms(kmsId, tx);
if (kms.isExternal) return;
if (kms.orgId !== orgId) throw new ForbiddenRequestError({ message: "KMS doesn't belong to organization" });
if (kms.orgId !== orgId) throw new BadRequestError({ message: "KMS doesn't belong to organization" });
return kmsDAL.deleteById(kmsId, tx);
};
@@ -638,7 +638,7 @@ export const kmsServiceFactory = ({
}
if (kmsDoc.orgId !== project.orgId) {
throw new ForbiddenRequestError({
throw new BadRequestError({
message: "KMS ID does not belong in the organization."
});
}
@@ -722,8 +722,8 @@ export const kmsServiceFactory = ({
}
if (backupProjectId !== projectId) {
throw new ForbiddenRequestError({
message: "Backup does not belong to project"
throw new BadRequestError({
message: "Invalid backup for project"
});
}