title: Proper way to catch exception from JSON.parse
body: <p>I’m using <code>JSON.parse</code> on a response that sometimes contains a 404 response. In the cases where it returns 404, is there a way to catch an exception and then execute some other code?</p>
  
  <pre><code>data = JSON.parse(response, function (key, value) {
      var type;
      if (value &amp;&amp; typeof value === 'object') {
          type = value.type;
          if (typeof type === 'string' &amp;&amp; typeof window[type] === 'function') {
              return new(window[type])(value);
          }
      }
      return value;
  });
  </code></pre>