Skip to content Skip to sidebar Skip to footer

I Got Undefined While Checking Error Kind In Mongodb

When I enter valid id after /user/ as 'http://localhost:5000/api/profile/user/5ee9fbe0e82023146c8a5230', it returns result as expected. But I need to check error kind if error occu

Solution 1:

According to the documentation the kind-property is only populated for ValidatorErrors.

In your case you get an error of type CastError which does not have kind listed in its properties: https://mongoosejs.com/docs/api.html#mongoose_Mongoose-CastError

So this seems like working as intended.

Post a Comment for "I Got Undefined While Checking Error Kind In Mongodb"