diff --git a/libs/core-rest-api/adapters/src/controllers/api/use-cases/clinic/create-clinic/create-clinic.e2e-spec.ts b/libs/core-rest-api/adapters/src/controllers/api/use-cases/clinic/create-clinic/create-clinic.e2e-spec.ts index 84b4ca7..bc3ea85 100644 --- a/libs/core-rest-api/adapters/src/controllers/api/use-cases/clinic/create-clinic/create-clinic.e2e-spec.ts +++ b/libs/core-rest-api/adapters/src/controllers/api/use-cases/clinic/create-clinic/create-clinic.e2e-spec.ts @@ -112,7 +112,7 @@ describe('[E2E] - Create Clinic', () => { .set('Authorization', `Bearer ${access_token}`) .send(clinic); - expect(createdClinicResponse.statusCode).toBe(500); - expect(createdClinicResponse.body.message).contain('An error occurred while processing your request'); + expect(createdClinicResponse.statusCode).toBe(400); + expect(createdClinicResponse.body.message).contain("Invalid `this.postgreSqlPrismaOrmService['clinic'].create()`"); }); }); diff --git a/libs/core-rest-api/core/src/shared/errors/globalAppHttpException.ts b/libs/core-rest-api/core/src/shared/errors/globalAppHttpException.ts index f6a1538..db0dde1 100644 --- a/libs/core-rest-api/core/src/shared/errors/globalAppHttpException.ts +++ b/libs/core-rest-api/core/src/shared/errors/globalAppHttpException.ts @@ -54,7 +54,7 @@ export class GlobalAppHttpException { exceptionMessage += ` Prisma Error Code: ${error.code}.`; } - if (error.code === 'P2002') { + if (error.code === 'P2002' || error.code === 'P2003') { // Remover linhas e espaços extras const relevantLines = error.message .split('\n')