mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 22:51:53 +00:00
Revert "feat(api): better errors and documentation"
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user