Angelo Chen
unread,Jul 17, 2012, 12:46:48 AM7/17/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Express
Hi,
In Java web apps, if an exception happens, only that user experience
it, other does not, thanks to its multi thread nature, and yet, the
program will never terminate, but simply goes back, allow you to
refresh or do something else.
In node/express, like following code:
exports.query_card = (req, res) ->
dao.get_card req.params.key, (err, card) ->
res.json({ status:'OK', flag: card.flag});
if the card is null, it will display this then program terminates:
node.js:201
throw e; // process.nextTick error, or 'error' event on first
tick
^
TypeError: Cannot read property 'closed' of null
run it under NODE_ENV=production, same result,
I know i need to check if it's null first before using it, but is
there some way to keep it running without terminating? using Forever/
Monit is one option, however it's different, it restarts the app, not
keeping the app running after exception, ideas?
Thanks,
Angelo