title: IE6 Try/Catch block does not work on custom document.someFunction call
body: <p>How can I attach a function to the global document object in IE6, and still be able to catch exceptions thrown from that function when called?</p>
  
  <p>Surprisingly, the exception does not propagate outside the function in IE6 in example below:</p>
  
  <pre class="lang-js prettyprint-override"><code>// Declare function on document
  document.someFn = function()
  {
      throw new Error('Raised error');
  }
  
  // IE6: bug??
  try{
      document.someFn('some parameter');
      alert('2. error has not been raised: bad!');
  }
  catch(err) {
  }
  </code></pre>
  
  <p>You can try out the example and some extra test cases here:</p>
  
  <p><a href="http://www.pokret.org/stuff/ie6-bug-test.html" rel="nofollow">http://www.pokret.org/stuff/ie6-bug-test.html</a></p>
  
  <p>Any workaround ideas?</p>