implemented mongoose errors in errorHandler middleware