Is there a way to add try-catch to every function in Javascript?

后端 未结 5 1343
心在旅途
心在旅途 2021-02-04 02:32

For error reporting, I would like to insert a try-catch wrapper around the code of every function I have.

So basically I want to replace

function foo(ar         


        
5条回答
  •  星月不相逢
    2021-02-04 03:00

    Okay, I seem to have found it here: http://www.nczonline.net/blog/2009/04/28/javascript-error-handling-anti-pattern/

    Basically, all functions are replaced by a try-catch wrapper with the original function in the try part.

提交回复
热议问题