Skip to content

Instantly share code, notes, and snippets.

@ff6347
Created May 10, 2012 17:34
Show Gist options
  • Save ff6347/2654624 to your computer and use it in GitHub Desktop.
Save ff6347/2654624 to your computer and use it in GitHub Desktop.
catch an error
try{
var no_no = nothing; // nothing does not exist
// so this produces an error
}catch(e){
// open a window and show the alert.
// \n is just a breakline
// \" is to show quotation marks in text
alert("This is the error message \"e\":\n" + e);
}
@ff6347
Copy link
Author

ff6347 commented May 11, 2012

This Gist is part of MT4D coming soon on fabiantheblind.info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment