Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

ryanmorr/try-catch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tryCatch

Emulates a native try/catch block for customized functionality and greater performance benefits in some circumstances. Please refer to the blog post for more detailed information regarding this project. Be advised, this is an expertimental project, use at your own risk.

Usage

The function has two required parameters, the first being a "try" function to test code, the second being a "catch" function which will be invoked and passed an error object if an exception is raised.

tryCatch(function(){
	// try something   
}, function(error){
	// handle error
});

Returning false in the "catch" function will allow the error to propagate to the browser. Returning anything else or nothing at all will suppress the error.

License

This project is dedicated to the public domain as described by the Unlicense.

About

Experimental alternative to a try/catch block in JavaScript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published