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
@@ -50,7 +50,7 @@ export const projectEnvServiceFactory = ({
if (existingEnv)
throw new BadRequestError({
message: "Environment with slug already exist",
name: "CreateEnvironment"
name: "Create envv"
});
const project = await projectDAL.findById(projectId);
@@ -94,14 +94,14 @@ export const projectEnvServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Environments);
const oldEnv = await projectEnvDAL.findOne({ id, projectId });
if (!oldEnv) throw new NotFoundError({ message: "Environment not found" });
if (!oldEnv) throw new BadRequestError({ message: "Environment not found" });
if (slug) {
const existingEnv = await projectEnvDAL.findOne({ slug, projectId });
if (existingEnv && existingEnv.id !== id) {
throw new BadRequestError({
message: "Environment with slug already exist",
name: "UpdateEnvironment"
name: "Create envv"
});
}
}
@@ -128,9 +128,9 @@ export const projectEnvServiceFactory = ({
const env = await projectEnvDAL.transaction(async (tx) => {
const [doc] = await projectEnvDAL.delete({ id, projectId }, tx);
if (!doc)
throw new NotFoundError({
throw new BadRequestError({
message: "Env doesn't exist",
name: "DeleteEnvironment"
name: "Re-order env"
});
await projectEnvDAL.updateAllPosition(projectId, doc.position, -1, tx);