Die QUIETLY!

Wednesday, 19 March 2008

Here is a piece of JavaScript code taken from a public commercial website. I have redacted some of the code to protect the guilty, but the rest is verbatim in all its glory. See if you can spot the error.

try {
   doSomething();
} catch(err) {
   // Die quietly
   alert(err);
}

Tags: ,

4 comments

You can leave a comment, or trackback from your own site.

  1. very funny 🙂
    thanks for sharing ..

  2. ummm no idea.. will the exception in inner function not result in CATCH being called?

    whtevurr

  3. I have an even more quiet solution !

    try {
    doSomething();
    } catch(err) {
    // Die a slow and quiet death
    while(1) {
    alert(err);
    }
    }

  4. @Raman – alert is not exactly quiet.

Leave a comment