nit: small patch to request error status

This commit is contained in:
Maidul Islam
2024-01-28 14:36:57 -05:00
parent 4e20735f98
commit a6ead9396c
2 changed files with 5 additions and 6 deletions
+3 -3
View File
@@ -15,15 +15,15 @@ export const fastifyErrHandler = fastifyPlugin(async (server: FastifyZodProvider
req.log.error(error); req.log.error(error);
if (error instanceof BadRequestError) { if (error instanceof BadRequestError) {
res.status(400).send({ statusCode: 400, message: error.message, error: error.name }); res.status(400).send({ statusCode: 400, message: error.message, error: error.name });
} else if (error instanceof UnauthorizedError || error instanceof ForbiddenRequestError) { } else if (error instanceof UnauthorizedError) {
res.status(403).send({ statusCode: 403, message: error.message, error: error.name }); res.status(403).send({ statusCode: 403, message: error.message, error: error.name });
} else if (error instanceof DatabaseError || error instanceof InternalServerError) { } else if (error instanceof DatabaseError || error instanceof InternalServerError) {
res.status(500).send({ statusCode: 500, message: "Something went wrong", error: error.name }); res.status(500).send({ statusCode: 500, message: "Something went wrong", error: error.name });
} else if (error instanceof ZodError) { } else if (error instanceof ZodError) {
res.status(403).send({ statusCode: 403, error: "ValidationFailure", message: error.issues }); res.status(403).send({ statusCode: 403, error: "ValidationFailure", message: error.issues });
} else if (error instanceof ForbiddenError) { } else if (error instanceof ForbiddenError) {
res.status(403).send({ res.status(401).send({
statusCode: 403, statusCode: 401,
error: "PermissionDenied", error: "PermissionDenied",
message: `You are not allowed to ${error.action} on ${error.subjectType}` message: `You are not allowed to ${error.action} on ${error.subjectType}`
}); });
@@ -81,13 +81,12 @@ export const ProjectIndexSecretsSection = ({ decryptFileKey }: Props) => {
</div> </div>
</div> </div>
)} )}
<p className="mb-2 text-lg font-semibold">Enable Blind Indices</p> <p className="mb-2 text-lg font-semibold">Action Required</p>
<p className="mb-4 leading-7 text-gray-400"> <p className="mb-4 leading-7 text-gray-400">
Your project was created before the introduction of blind indexing. To continue accessing Your project was created before the introduction of blind indexing. To continue accessing
secrets by name through the SDK, public API and web dashboard, please enable blind indexing.{" "} secrets by name through the SDK, public API and web dashboard, please enable blind indexing.{" "}
<b> <b>
This is a one time process.{" "} {membership.role !== ProjectMembershipRole.Admin && "This is an admin only operation."}
{membership.role !== ProjectMembershipRole.Admin && "Admin only operation"}
</b> </b>
</p> </p>
<ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}> <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>