diff --git a/src/controllers/product/product-controller.ts b/src/controllers/product/product-controller.ts index 59e550e..aabdbc5 100644 --- a/src/controllers/product/product-controller.ts +++ b/src/controllers/product/product-controller.ts @@ -97,7 +97,7 @@ export class ProductController extends Controller { }); if (!record) { - throw new HttpError(HttpStatus.NOT_FOUND, "Product cannot be found.", "data_not_found"); + throw new HttpError(HttpStatus.NOT_FOUND, "Product cannot be found.", "productNotFound"); } return Object.assign(record, { @@ -156,7 +156,7 @@ export class ProductController extends Controller { @Path() productId: string, ) { if (!(await prisma.product.findUnique({ where: { id: productId } }))) { - throw new HttpError(HttpStatus.NOT_FOUND, "Product cannot be found.", "data_not_found"); + throw new HttpError(HttpStatus.NOT_FOUND, "Product cannot be found.", "productNotFound"); } const record = await prisma.product.update({ @@ -182,11 +182,11 @@ export class ProductController extends Controller { const record = await prisma.product.findFirst({ where: { id: productId } }); if (!record) { - throw new HttpError(HttpStatus.NOT_FOUND, "Product cannot be found.", "data_not_found"); + throw new HttpError(HttpStatus.NOT_FOUND, "Product cannot be found.", "productNotFound"); } if (record.status !== Status.CREATED) { - throw new HttpError(HttpStatus.FORBIDDEN, "Product is in used.", "data_in_used"); + throw new HttpError(HttpStatus.FORBIDDEN, "Product is in used.", "productInUsed"); } return await prisma.product.delete({ where: { id: productId } });