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:
Go to '/notes/:id'.
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.
When an invalid
ObjectId
is passed on to the notes controllers it returnsinternal server error
with the status code of500
and gives the following error:To Reproduce Steps to reproduce the behavior:
/:id
with an invalidObjectId
.Expected behavior The server must return an error message of
id is not valid.
with a status code of400 -Bad Request
.