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.
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?
On Mon, Jul 16, 2012 at 9:46 PM, Angelo Chen <angelochen...@gmail.com> wrote:
> 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.
> 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
> --
> You received this message because you are subscribed to the Google Groups "Express" group.
> To post to this group, send email to express-js@googlegroups.com.
> To unsubscribe from this group, send email to express-js+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/express-js?hl=en.
> On Mon, Jul 16, 2012 at 9:46 PM, Angelo Chen <angelochen...@gmail.com> wrote:
> > 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.
> > 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
> > --
> > You received this message because you are subscribed to the Google Groups "Express" group.
> > To post to this group, send email to express-js@googlegroups.com.
> > To unsubscribe from this group, send email to express-js+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/express-js?hl=en.
I am not sure what is the context for you question: what is the use case
and the are the actions you would like to take when an error occurs?
If you are asking "I just want to write a very light code without any
data sanitizing, without checking the result of operation that may cause an
error and exception and without taking care to recover from an error" then
using a global event listener for errors is fine, especially when we write
a quick and dirty throwaway code.
On other hand implementing a generic data sanitizer is relatively simple
and having an error handler that will allow you to recover from a specific
error in a specific context and take appropriate actions according to the
business logic, data flow and user experience makes more sense to me and
will have much more value in a long run.
Another approach will be to create a global context object and update it
when you go to the next step of your logic. This will allow the global
error handler can take into account the state when the error toke place,
and react accordingly.
I hope this helps.
Thomas
Thomas
------
On 17 July 2012 07:36, Angelo Chen <angelochen...@gmail.com> wrote:
> i think that's a good place to email me the problem, but after that?
> On Jul 17, 1:38 pm, Scott <sheb...@gmail.com> wrote:
> > One thing I did that helped a lot is add this to app.js (in production
> > I have it send me an email notice):
> > On Mon, Jul 16, 2012 at 9:46 PM, Angelo Chen <angelochen...@gmail.com>
> wrote:
> > > 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.
> > > 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
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Express" group.
> > > To post to this group, send email to express-js@googlegroups.com.
> > > To unsubscribe from this group, send email to
> express-js+unsubscribe@googlegroups.com.
> > > For more options, visit this group athttp://
> groups.google.com/group/express-js?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "Express" group.
> To post to this group, send email to express-js@googlegroups.com.
> To unsubscribe from this group, send email to
> express-js+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/express-js?hl=en.
> On Mon, Jul 16, 2012 at 9:46 PM, Angelo Chen <angelochen...@gmail.com> wrote:
> > 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.
> > 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
> > --
> > You received this message because you are subscribed to the Google Groups "Express" group.
> > To post to this group, send email to express-js@googlegroups.com.
> > To unsubscribe from this group, send email to express-js+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/express-js?hl=en.