original_string: public function error(RESTfulAPIError $error)
      {
          $answer = new HTTPResponse();
  
          $body = $this->serializer->serialize($error->body);
          $answer->setBody($body);
  
          $answer->setStatusCode($error->code, $error->message);
          $answer->addHeader('Content-Type', $this->serializer->getcontentType());
  
          $answer = $this->setAnswerCORS($answer);
  
          // save controller's response then return/output
          $this->response = $answer;
  
          return $answer;
      }
code: public function error(RESTfulAPIError $error)
      {
          $answer = new HTTPResponse();
  
          $body = $this->serializer->serialize($error->body);
          $answer->setBody($body);
  
          $answer->setStatusCode($error->code, $error->message);
          $answer->addHeader('Content-Type', $this->serializer->getcontentType());
  
          $answer = $this->setAnswerCORS($answer);
  
          // save controller's response then return/output
          $this->response = $answer;
  
          return $answer;
      }
code_tokens: public function error ( RESTfulAPIError $ error ) { $ answer = new HTTPResponse ( ) ; $ body = $ this -> serializer -> serialize ( $ error -> body ) ; $ answer -> setBody ( $ body ) ; $ answer -> setStatusCode ( $ error -> code , $ error -> message ) ; $ answer -> addHeader ( 'Content-Type' , $ this -> serializer -> getcontentType ( ) ) ; $ answer = $ this -> setAnswerCORS ( $ answer ) ; // save controller's response then return/output $ this -> response = $ answer ; return $ answer ; }
docstring: Handles formatting and output error message
  then exit.
  
  @param  RESTfulAPIError $error Error object to return
  @return HTTPResponse
docstring_tokens: Handles formatting and output error message then exit .