Skip to content

Instantly share code, notes, and snippets.

@dtsn
Created November 5, 2010 11:35
Show Gist options
  • Save dtsn/664013 to your computer and use it in GitHub Desktop.
Save dtsn/664013 to your computer and use it in GitHub Desktop.
Custom Exceptions in JavaScript
function myExceptionHandler() {}
try {
throw new myExceptionHandler;
} catch (e) {
if (e instanceOf myExceptionHandler) {
// handle it
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment