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;
    }