title: Slim: how to catch invalid routes?
body: <p>I have set up a simple RESTful service with <code>Slim</code>.<br>
  This is an excerpt of my routing:</p>
  
  <pre><code>...
  $app-&gt;get('/persons/get', function() { getPersons(); });
  $app-&gt;get('/persons/get/:id', function($id) { getPerson($id); });
  $app-&gt;put('/persons/setprop/:id/:prop', function($id) { setPersonProp($id); });
  
  $app-&gt;options('/.+', function() { options(); });
  
  $app-&gt;run();
  </code></pre>
  
  <p>If I get an unforeseen request <code>Slim</code> answers with a <strong>405 Method Not Allowed</strong> HTTP status code.<br>
  How can I catch unforeseen requests, to customize answer?</p>
  
  <p><strong>UPDATE:</strong><br>
  As @Martin Turjak suggested, I did add error() and notFound() methods, so this is my current code:</p>
  
  <pre><code>...
  $app-&gt;get('/persons/get', function() { getPersons(); });
  $app-&gt;get('/persons/get/:id', function($id) { getPerson($id); });
  $app-&gt;put('/persons/setprop/:id/:prop', function($id) { setPersonProp($id); });
  
  $app-&gt;options('/.+', function() { options(); });
  
  $app-&gt;error(function(Exception $e) {
      echo("Error:");
      var_dump($e);
  });
  $app-&gt;notFound(function() {
      echo("Not Found!");
  });
  
  $app-&gt;run();
  </code></pre>
  
  <p>For some reason, nor $app->notFound() nor $app->error() seem to be registered... I keep getting a <strong>405</strong> error for wrong routes... :-(<br>
  For example, calling <em><a href="http://localhost/myapp/api/persons/NOT_EXISTING_ROUTE" rel="nofollow">http://localhost/myapp/api/persons/NOT_EXISTING_ROUTE</a></em></p>
  
  <p><em>Note: I am currently testing Slim service from the same domain, but I need it to work cross-domain, too...</em></p>