Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
feat: create invalid payload handler
Browse files Browse the repository at this point in the history
  • Loading branch information
NotHydra committed Feb 9, 2024
1 parent 7bde54f commit 3474bd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions apps/api/src/model/base.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ export class BaseService<ModelType, ModelCreateDTO, ModelUpdateDTO> {
throw error;
}

if (error instanceof PrismaClientKnownRequestError) {
this.loggerService.error("Add: Invalid Payload");
throw new BadRequestException("Invalid Payload");
}

this.loggerService.error(`Add: ${error.message}`);
throw new InternalServerErrorException("Internal Server Error");
}
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/model/sub-trash-bin/sub-trash-bin.rest
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ POST http://localhost:3001/api/sub-trash-bin
Content-Type: application/json

{
"trashBinId": 2,
"trashBinId": 21,
"name": "Sub Trash Bin 3"
}

Expand Down

0 comments on commit 3474bd4

Please sign in to comment.