mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 15:40:47 +00:00
feat: more contextual not found errors
This commit is contained in:
@@ -186,7 +186,7 @@ export const projectDALFactory = (db: TDbClient) => {
|
||||
})?.[0];
|
||||
|
||||
if (!project) {
|
||||
throw new NotFoundError({ message: "Project not found" });
|
||||
throw new NotFoundError({ message: `Project with ID '${id}' not found` });
|
||||
}
|
||||
|
||||
return project;
|
||||
@@ -235,7 +235,7 @@ export const projectDALFactory = (db: TDbClient) => {
|
||||
})?.[0];
|
||||
|
||||
if (!project) {
|
||||
throw new NotFoundError({ message: "Project not found" });
|
||||
throw new NotFoundError({ message: `Project with slug '${slug}' not found` });
|
||||
}
|
||||
|
||||
return project;
|
||||
@@ -295,7 +295,7 @@ export const projectDALFactory = (db: TDbClient) => {
|
||||
.first();
|
||||
|
||||
if (!project) {
|
||||
throw new NotFoundError({ message: "Project not found" });
|
||||
throw new NotFoundError({ message: `Project with ID '${projectId}' not found` });
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -75,7 +75,7 @@ export const getProjectKmsCertificateKeyId = async ({
|
||||
const keyId = await projectDAL.transaction(async (tx) => {
|
||||
const project = await projectDAL.findOne({ id: projectId }, tx);
|
||||
if (!project) {
|
||||
throw new NotFoundError({ message: "Project not found" });
|
||||
throw new NotFoundError({ message: `Project with ID '${projectId}' not found` });
|
||||
}
|
||||
|
||||
if (!project.kmsCertificateKeyId) {
|
||||
|
||||
@@ -327,7 +327,7 @@ export const projectServiceFactory = ({
|
||||
// If identity org membership not found, throw error
|
||||
if (!identityOrgMembership) {
|
||||
throw new NotFoundError({
|
||||
message: `Failed to find identity with id ${actorId}`
|
||||
message: `Failed to find identity with id '${actorId}'`
|
||||
});
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ export const projectServiceFactory = ({
|
||||
const project = await projectDAL.findProjectBySlug(workspaceSlug, actorOrgId);
|
||||
if (!project) {
|
||||
throw new NotFoundError({
|
||||
message: "Project not found"
|
||||
message: `Project with slug '${workspaceSlug}' not found`
|
||||
});
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ export const projectServiceFactory = ({
|
||||
const project = await projectDAL.findProjectBySlug(workspaceSlug, actorOrgId);
|
||||
if (!project) {
|
||||
throw new NotFoundError({
|
||||
message: "Project not found."
|
||||
message: `Project with slug '${workspaceSlug}' not found`
|
||||
});
|
||||
}
|
||||
|
||||
@@ -634,7 +634,7 @@ export const projectServiceFactory = ({
|
||||
|
||||
if (!project) {
|
||||
throw new NotFoundError({
|
||||
message: `Project with id ${projectId} not found`
|
||||
message: `Project with ID '${projectId}' not found`
|
||||
});
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ export const projectServiceFactory = ({
|
||||
const project = await projectDAL.findById(projectId);
|
||||
if (!project) {
|
||||
throw new NotFoundError({
|
||||
message: "Project not found"
|
||||
message: `Project with ID '${projectId}' not found`
|
||||
});
|
||||
}
|
||||
|
||||
@@ -967,14 +967,21 @@ export const projectServiceFactory = ({
|
||||
const project = await projectDAL.findById(projectId);
|
||||
if (!project) {
|
||||
throw new NotFoundError({
|
||||
message: "Project not found"
|
||||
message: `Project with ID '${projectId}' not found`
|
||||
});
|
||||
}
|
||||
|
||||
const slackIntegration = await slackIntegrationDAL.findByIdWithWorkflowIntegrationDetails(slackIntegrationId);
|
||||
|
||||
if (!slackIntegration) {
|
||||
throw new NotFoundError({
|
||||
message: "Slack integration not found"
|
||||
message: `Slack integration with ID '${slackIntegrationId}' not found`
|
||||
});
|
||||
}
|
||||
|
||||
if (slackIntegration.orgId !== actorOrgId) {
|
||||
throw new ForbiddenRequestError({
|
||||
message: "Selected slack integration is not in the same organization"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user