Experimental alternative to a try/catch block in JavaScript
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Latest commit 3dc49ef May 9, 2016
Failed to load latest commit information.
test Add unit testing May 9, 2016
.gitattributes Update git config May 7, 2016
.gitignore Update git config May 7, 2016
README.md Refactored and other minor updates Mar 7, 2015
UNLICENSE Initial commit Sep 23, 2013
try-catch.js Add strict mode May 7, 2016



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.


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.

	// 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.


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