celeroncoder / notary-API

Notes App with NestJS-Typescript, MongoDB.
MIT License
2 stars 1 forks source link

Create an ObjectId validator #5

Closed celeroncoder closed 3 years ago

celeroncoder commented 3 years ago

When an invalid ObjectId is passed on to the notes controllers it returns internal server error with the status code of 500 and gives the following error:

Cannot Cast to ObjectId -> mongoose error

To Reproduce Steps to reproduce the behavior:

  1. Go to '/notes/:id'.
  2. replace the /:id with an invalid ObjectId.

Expected behavior The server must return an error message of id is not valid. with a status code of 400 -Bad Request.

repo-ranger[bot] commented 3 years ago

⚠️ This has been marked to be closed in 7 days.

celeroncoder commented 3 years ago

fixed by #6