title: Symfony2, periodic JS failure with FOS Routing
body: <p>Sometimes my JS fails to load dynamically via Symfony2, the URLs look like;</p>
  
  <blockquote>
    <p>/app_dev.php/js/d5fb045_part_1_main_4.js</p>
  </blockquote>
  
  <p>Looking at this URL using dev tools shows that the JS is returning;</p>
  
  <blockquote>
    <p>Fatal error: Call to undefined method ErrorException::getStatusCode() in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php on line 105</p>
  </blockquote>
  
  <p>The JS error thrown when this is returned is of course;</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected identifier</p>
  </blockquote>
  
  <p>What is going wrong?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This does not seem to happen in the prod env. Only in dev.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>This is worth showing too <a href="https://i.stack.imgur.com/U39ut.png" rel="nofollow noreferrer">Full Image</a></p>
  
  <p><img src="https://i.stack.imgur.com/U39ut.png" alt="enter image description here"> </p>
  
  <p>I am using FOS Routing, it seems to fail and then everything else is canceled. The call to <code>/app_dev.php/js/routing?callback=fos.Router.setData</code> returns nothing, just a blank page with a 500 code.</p>
  
  <p>Although this is not always the case, as here FOS Routing works and then the KnockJS file fails. <a href="https://i.stack.imgur.com/DHYXL.png" rel="nofollow noreferrer">Full Image</a></p>
  
  <p><img src="https://i.stack.imgur.com/DHYXL.png" alt="enter image description here"></p>
  
  <p><strong>Edit 3</strong></p>
  
  <p>This does not seem to happen either when accessing the file directly at</p>
  
  <blockquote>
    <p><a href="http://www.example.com/app_dev.php/css/9d6987e_part_1_style_1.css" rel="nofollow noreferrer">http://www.example.com/app_dev.php/css/9d6987e_part_1_style_1.css</a></p>
  </blockquote>
  
  <p>Its only when it loads from within a page.</p>