开发者

JavaScript global logging [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Duplicate:

Javascipt exception handling

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 fou开发者_如何学JAVAnd 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


Ah, window.onerror... :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜