Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- functionName.before("try {")
- functionName.after("} catch(ex){
- //dostuff
- }")
- Function.prototype.wrapTry = function(handle) {
- var fn = this;
- return function() {
- try {
- return fn.apply(this, arguments);
- } catch(e) {
- return handle(e);
- }
- };
- };
- var safeFunction = functionName.wrapTry(doStuff);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement