title: debugging jquery ajax script with runtime error
body: <p>How can I see a runtime error from a jQuery AJAX received script?</p>
  
  <p>I'm coding a (free software) application (the MELT monitor, on GNU/Linux/Debian/x86-64) which embeds its specific web server. See <a href="https://stackoverflow.com/q/33565773/841108">this question</a>  for details. I'm at commit <a href="https://github.com/bstarynk/melt-monitor-2015/commit/d624e22497de1a3da9e55705d8b34a4a4712dadb" rel="nofollow noreferrer">d624e22497de...</a></p>
  
  <p>I'm using Firefox 38 or 42 on Linux/Debian/Gnu/x86-64 with a recent Firebug.</p>
  
  <p>I'm using a jQuery's <code>$.ajax</code> with a script:</p>
  
  <pre><code>$.ajax
  ({url: "/canvasedit",
    method: "POST",
    data: {"do_fillcanvas": true},
    dataType: "script",
    success: ajaxcanvascript
   });
  </code></pre>
  
  <p>The <code>ajaxcanvascript</code> is correctly called (and the <code>console.log</code> there is displayed), so from an HTTP point of view, the AJAX request has succeeded (200 OK).</p>
  
  <p>However, when there is a runtime error in the AJAX received script by <code>do_fillcanvas</code>, which is a <em>generated</em> script similar to something like:</p>
  
  <pre><code>     console.log('dofillcanvas canvedit.c:206 siz 1; this=', this,
          ' momc_display_canvas=',momc_display_canvas);
   momc_display_canvas('09:26:39',[
       momc_top_entry(momc_item_ref('notice'),
             momc_node(momc_item_ref('comment'),
                   [
                   momc_string("some simple notice"),
                   momc_node(momc_item_ref('web_state'),
                         [
                             momc_int(2)]),
                   momc_item_val('hashset'), momc_set([
                       momc_item_ref('canvasedit'),
                       momc_item_ref('microedit'), momc_item_ref('the_agenda')])
                   ,
                   momc_tuple([
                       momc_item_ref('web_session'), momc_nil_ref(), 
                       momc_item_ref('the_system')])
                   ]))]);
  
   console.log('dofillcanvas canvedit.c:239 this=', this);
   addupdatehtml('displayed &lt;tt&gt;Sat Nov  7 09:26:39 2015 MET&lt;/tt&gt;');
   console.log('dofillcanvas canvedit.c:252 done 09:26:39.11 this=', this);
  </code></pre>
  
  <p>I've got no error message in my Firebug console (or nothing easily visible from Firefox).</p>
  
  <p>The kind of runtime error I am debugging is e.g. some undefined method called deep from <code>momc_display_canvas</code> (which uses <a href="http://projects.calebevans.me/jcanvas" rel="nofollow noreferrer">jcanvas</a>, which I am not very familiar with).</p>
  
  <p>So, <strong>how to easily see runtime error from a jQuery AJAX received script?</strong></p>
  
  <p>I'm adding <code>console.log</code> everywhere, but that is not convenient...</p>