These are chat archives for Automattic/mongoose

12th
Jun 2015
Stephan Kristyn
@nottinhill
Jun 12 2015 12:45
Hi any suggestion how to Unit Test express.js routes that call Mongoose Models / MongogDB ?
Erinç Fırtına
@EricMcRay
Jun 12 2015 14:22
How do you guys handle translation of mongoose validation errors? I get lang from header but I couldnt figure out how can translate mongoose validation errors
Eloy Toro
@eloytoro
Jun 12 2015 15:10
@EricMcRay what do you mean? mongoose docs cover validation error handling
@nottinhill personally I do requests to my own app and then validate the response
Erinç Fırtına
@EricMcRay
Jun 12 2015 15:12
@eloytoro when I get mongoose validation error I want to translate that error to users language
Eloy Toro
@eloytoro
Jun 12 2015 15:14
Assuming youre displaying the erros to the user with a front-end UI you could catch 400 responses from the server and do a switch over the returned error
Erinç Fırtına
@EricMcRay
Jun 12 2015 15:16
so you are saying I should handle all translation on client-side?
Eloy Toro
@eloytoro
Jun 12 2015 16:39
It would be in your best interest in case youre aiming to create a server application that has a documented list of validation errors and a client application thats able to translate server errors into any given language