/**
  * If an AmpacheException is being caught, the appropiate ampache
  * exception response is rendered
  * @param Controller $controller the controller that is being called
  * @param string $methodName the name of the method that will be called on
  *                           the controller
  * @param \Exception $exception the thrown exception
  * @throws \Exception the passed in exception if it cant handle it
  * @return Response a Response object or null in case that the exception could not be handled
  */
 public function afterException($controller, $methodName, \Exception $exception)
 {
     if ($exception instanceof AmpacheException && $this->isAmpacheCall) {
         $response = new TemplateResponse($this->api, 'ampache/error');
         $response->renderAs('blank');
         $response->addHeader('Content-Type', 'text/xml; charset=UTF-8');
         $response->setparams(array('code' => $exception->getCode(), 'message' => $exception->getMessage()));
         return $response;
     }
     throw $exception;
 }