views:

30

answers:

1

Hi,

is it possible to add some global exception listener in javascript? Let's say I have JS function:

function log(message) {
  alert('logged: ' + message);
}

and I want to invoke it if any exception occurs on page. It is well known that aop is ideal for that case, but is there any really useful library which has that well advise-pointcut system and is well documented with examples?

Mostly i found only libraries where you must define pointcut as single function name, not some regex (* - like all functions).

Maybe AOP is not exactly needed, if you know some solution how to log all the exceptions occured during processing any javascript function on page without need to add try-catch block to all those functions, let me know.

Thanks Zdenek

+1  A: 

Ah, window.onerror... :-)

Zdenek Obst