public function onEventException(Application $app, \Exception $e)
 {
     $response = $app->response('', 500);
     if ($e instanceof HttpException) {
         $response->setStatusCode($e->getStatusCode());
     }
     if ($app->getParameter('debug')) {
         $response->setContent($this->prettyException($e));
     }
     $app->setResponse($response);
 }