Throw an HttpException with the given message.

@param int    $code
@param string $message
@param array  $headers
@throw \Cygnite\Exception\Http\HttpNotFoundException|Cygnite\Exception\Http\HttpException

@return void
354706
public function abort(int $code, string $message = '', array $headers = [])
    {
        if ($code == 404) {
            throw new \Cygnite\Exception\Http\HttpNotFoundException($message);
        }

        throw new \Cygnite\Exception\Http\HttpException($code, $message, null, $headers);
    }
823971
static public function sendHeader( $code, $protocol = "HTTP/1.0" ){
		$text = self::getText( $code );
		header( $protocol.' '.$code.' '.$text );
	}
798620
public function withError($message, $errorCode = 500, array $headers = [])
    {
        $data = [
            'status'  => false,
            'success' => false,
            'code'    => $errorCode ?: $this->getStatusCode(),
            'msg'     => $message,
            'error'   => [
                'code'      => $errorCode,
                'http_code' => $this->statusCode,
                'message'   => $message,
            ],
        ];

        return $this->response($data, $headers);
    }
12552
public function notImplemented($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_NOT_IMPLEMENTED, $headers);
    }
870865
public function exception($message = 'Undefined Exception', $type = null, $code = null)
    {
        $o = $this->owner ? $this->owner->__toString() : 'none';

        return parent::exception($message, $type, $code)
            ->addMoreInfo('owner', $o)
            ->addMoreInfo('template', $this->template_source)
            ;
    }
215691
private function throwBadRequest($message, $metadata = [], array $headers = [])
    {
        throw new HttpResponseException($this->badRequestResponse($message, $metadata, $headers));
    }
198154
public function statusCodeAction($code = null, $message = null)
    {
        $codes = [
            403 => "403 Forbidden",
            404 => "404 Not Found",
            500 => "500 Internal Server Error",
        ];

        // Key being integer also (unintentionally) prevents this action from direct url usage
        if (!$code || !in_array($code, $codes)) {
            throw new \Anax\Exception\NotFoundException("Not a valid HTTP status code.");
        }

           $title = $codes[$code];
           $this->di->response->setHeader($code);
           $this->di->theme->setTitle($title);
           $this->di->views->add('default/error', [
            'title' => $title,
            'content' => $message,
            'details' => $this->di->flash->getMessage(),
           ]);
    }
722962
protected final function error($code, $message = null) {
        if (empty($message) && is_string($code)) {
            $msg = explode('@', $code);
            if (count($msg) >= 2) {
                $message = $msg[1];
                $code    = intval($msg[0]);
            } else {
                $message = $code;
                $code    = 500;
            }
        } else if (empty($message)) {
            $message = __('Internal Error');
        }
        throw new RestException($message, $code);
    }
515516
protected function _throwValidationException(
        $message = null,
        $code = null,
        RootException $previous = null,
        $validator = null
    ) {
        if ($validator === true) {
            $validator = $this;
        }

        throw $this->_createValidationException($message, $code, $previous, $validator);
    }
980449
protected function error ($message = 'invalid request', $code = 0, $httpCode = 0) 
	{
		
		if (is_numeric ($message))
		{
			$error		= new Error ($message);
			$code		= $error->getCode ();
			$message	= $error->getMessage ();
		}
		else if ($message instanceof Error)
		{
			$code		= $message->getCode ();
			$message	= $message->getMessage ();
		}
		
		$this->view->response	= array (
			'success'			=> 0,
			'error_code'		=> $code,
			'error_description'	=> $message
		);
		
		if ($httpCode)
		{
			$this->httpStatus ($httpCode);
		}
		
		return FALSE;
		
	}
151802
private function throwValidationFailed($message, array $errors, $data = [], $status = 422, array $headers = [])
    {
        throw new HttpResponseException(
            $this->validationFailedResponse($message, $errors, $data, $status, $headers));
    }
484518
public function throwException($message = '', $type = 'default')
    {
        switch ($type) {
            case 'access-denied':
                throw new AccessDeniedException($message);
            case 'not-found':
                throw new NotFoundHttpException($message);
            case 'runtime':
                throw new \RuntimeException($message);
            default:
                throw new \Exception($message);
        }
    }
1106290
protected function setError($code, $message)
    {
        $this->error = new \OtherCode\Rest\Core\Error($code, $message);
    }
1224883
public function error($msg, Token $token = null, $code = 0)
    {
        $error = new ParserException(
            Translator::gettext($msg),
            $token,
            $code
        );
        parent::error($error);
    }
598893
public function setError($message, $code = 200, $info = null, $isSecurity = false)
    {
        if ($isSecurity) {
            $e = new \Gems_Exception_Security($message, $code, null, $info);
        } else {
            $e = new \Gems_Exception($message, $code, null, $info);
        }
        $this->setException($e);
    }
742735
private function throwFatalError($message, $data = [], array $headers = [])
    {
        throw new HttpResponseException($this->fatalErrorResponse($message, $data, $headers));
    }
166029
public function setHeader($header, $value)
    {
        if (is_array($value)) {
            throw new \Exception('Could not set the header: '.$header);
        }
        $this->headers[$header] = $value;
    }