title: How to throw a 400 bad request from a symfony controller?
body: <p>I have set up a very simple stub of a Symfony 3.3 controller whose main action looks looks like this:</p>
  
  <pre><code>/**
   * @Route("/pair-gallery/{id}")
   */
  public function indexAction(Int $id)
  {
      $output = [];
      return new JsonResponse($output);
  }
  </code></pre>
  
  <p>When I give it a string as an argument in the url (rather than an integer), I currently get a 500 error. That's not horrible, but it's not exactly what I want. </p>
  
  <p>How do I tell Symfony to send back a 400 ("Bad Request") response code instead? </p>