protected function handleError()
    {
        $okStatus = array(
            100, 200, 201,
        );
        $messages = array(
            401 => 'Authorization required',
            403 => 'Forbidden request',
            404 => 'Not found',
            406 => 'Not accepted',
            422 => 'Unprocessable entity',
            500 => 'Internal server error',
            501 => 'Method not implemented',
        );

        if (isset($messages[$this->httpStatus])) {
            throw new HttpStatusException($messages[$this->httpStatus], $this->httpStatus);
        }
        if (!in_array($this->httpStatus, $okStatus)) {
            throw new UnknownHttpStatusException('Unknown http status: ' . $this->httpStatus);
        }
    }