[go: up one dir, main page]

Skip to content

A small tool to automatically wrap your code with custom global exception handler by using the technology of AST

Notifications You must be signed in to change notification settings

foio/try-catch-global.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

try-catch-global.js

A small tool to automatically wrap your code with custom global exception handler by using the technology of AST.

run

npm install
cd test
node test

example

for input code:

var test = function(){
    console.log('test');
}

then transform it by try-catch-global.js:

var outputCode = globalFuncTryCatch(inputCode, function (error) {
   console.log(error);
});

the output code will be:

var test = function() {             
    try {                           
        console.log("test");        
    } catch (error) {               
        (function(error) {          
            console.log(error);     
        })(error);                  
    }                               
};                                  

About

A small tool to automatically wrap your code with custom global exception handler by using the technology of AST

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published