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;
    }
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;
    }
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 ; }
Handles formatting and output error message
then exit.

@param  RESTfulAPIError $error Error object to return
@return HTTPResponse
Handles formatting and output error message then exit .