What am I doing wrong with the following try, throw and catch exception handlers in Javascript?
<p>I have the following code that works without using throw however when I use the throw keyword it doesn't return the appropriate message. What am I doing wrong?</p>

<p><strong>Update</strong></p>

<p>I am deliberately calling the function <code>addme</code> as opposed to <code>addMe</code> as I want to catch the error message.</p>

<p><strong>Code - That works without using <code>throw</code></strong></p>

<pre><code>function addMe() {
        var a = 1;
        var b = 2;
        return a+b;
    }

    try {
        addme();
    }


    catch (err) {
        document.write(err.name + " " + err.message);
    }
</code></pre>

<p><strong>Code - That does not work</strong></p>

<pre><code>function addMe() {
        var a = 1;
        var b = 2;
        return a+b;
    }

    try {
        addme();
        throw "error 1";
    }

    catch(err) {
        if(err ==  "error 1") {
            document.write("This is a custom message for error 1");
        }
    }
</code></pre>
