Closed ryleyb closed 8 years ago
Probably would have made my life easier if I had logging enabled in production.
I had this problem, too. Agreed it would be nice to fail gracefully.
Paul
I can create a PR if that seems reasonable to you.
Please do :smile:
While deploying my express 3.X app the first time to production, I ran into an issue with readFile where it wasn't able to read the locales directory, and also didn't have permissions to write new files. Relevant code from i18n.js (https://github.com/jeresig/i18n-node-2/blob/master/i18n.js#L268):
The end result is that my app complains that it can't find
res.locals.__
. Which makes sense - the middleware for express inexpressBind
callsnew i18n(opts)
which isn't successful, and thus (silently AFAIK) dies.I think a reasonable thing to do might be to wrap the writeFile call in a try/catch and log an error. I can create a PR if that seems reasonable to you.
(PS: I'm not asking for help with my app - I just needed to explicitly pass the
directory
option)