title: test for a missing resource in Sencha Touch
body: <p>Here's a hopefully quick one for those with more Sencha Touch / Ext / JS experience than I have. How would I programmatically test for the existence of a remote resource, say an image? In other words how do I forestall an HTTP 404 before it happens and perform some default action, say swapping in a default image?</p>
  
  <p>Here is what I'm currently doing (the catch(e) block is never hit):</p>
  
  <pre><code>albumArtArea.setTpl('&lt;img class="cover_art" src="{iconUrl}"/&gt;');
  try {
      albumArtArea.setData(itemData);
  }
  catch (e) {
      // this block is never executed
      // 404 for missing album art; use the generic image
      itemData.iconUrl = "resources/images/img_music_generic.png";
      albumArtArea.setData(itemData);
  }
  </code></pre>