Any request that involves messages must define the client ID. This
        handles all failures due to lack of client ID and raises the
        appropriate exception.
491041
def _api_request(self, uri, method, **kwargs):
        
        try:
            return super(QueueClient, self)._api_request(uri, method, **kwargs)
        except exc.BadRequest as e:
            if ((e.code == "400") and
                    (e.message == 'The "Client-ID" header is required.')):
                raise exc.QueueClientIDNotDefined("You must supply a client ID "
                        "to work with Queue messages.")
            else:
                raise
1096894
def handle_error(self, request: Any, status: int = 500, exc: Any = None, message: Optional[str] = None) -> web.Response:
        """"""
        if self.transport is None:
            # client has been disconnected during writing.
            if self._access_log:
                request_ip = RequestHandler.get_request_ip(request, None)
                version_string = None
                if isinstance(request.version, HttpVersion):
                    version_string = 'HTTP/{}.{}'.format(request.version.major, request.version.minor)
                logging.getLogger('transport.http').info('[{}] [{}] {} {} "{} {}{}{}" - {} "{}" -'.format(
                    RequestHandler.colorize_status('http', 499),
                    RequestHandler.colorize_status(499),
                    request_ip or '',
                    '"{}"'.format(request._cache['auth'].login.replace('"', '')) if request._cache.get('auth') and getattr(request._cache.get('auth'), 'login', None) else '-',
                    request.method,
                    request.path,
                    '?{}'.format(request.query_string) if request.query_string else '',
                    ' {}'.format(version_string) if version_string else '',
                    request.content_length if request.content_length is not None else '-',
                    request.headers.get('User-Agent', '').replace('"', '')
                ))

        headers = {}
        headers[hdrs.CONTENT_TYPE] = 'text/plain; charset=utf-8'

        msg = '' if status == 500 or not message else message

        headers[hdrs.CONTENT_LENGTH] = str(len(msg))
        headers[hdrs.SERVER] = self._server_header or ''
        resp = web.Response(status=status,  # type: ignore
                            text=msg,
                            headers=headers)  # type: web.Response
        resp.force_close()  # type: ignore

        # some data already got sent, connection is broken
        if request.writer.output_size > 0 or self.transport is None:
            self.force_close()  # type: ignore
        elif self.transport is not None:
            request_ip = RequestHandler.get_request_ip(request, None)
            if not request_ip:
                peername = request.transport.get_extra_info('peername')
                if peername:
                    request_ip, _ = peername
            if self._access_log:
                logging.getLogger('transport.http').info('[{}] [{}] {} {} "INVALID" {} - "" -'.format(
                    RequestHandler.colorize_status('http', status),
                    RequestHandler.colorize_status(status),
                    request_ip or '',
                    '"{}"'.format(request._cache['auth'].login.replace('"', '')) if request._cache.get('auth') and getattr(request._cache.get('auth'), 'login', None) else '-',
                    len(msg)
                ))

        return resp
623542
@Override
    public void setClientID(String clientID) throws InvalidClientIDRuntimeException, IllegalStateRuntimeException, JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setClientID", new Object[] { clientID });

        try {
            jmsConnection.setClientID(clientID);
        } catch (InvalidClientIDException icie) {
            throw (InvalidClientIDRuntimeException) JmsErrorUtils.getJMS2Exception(icie, InvalidClientIDRuntimeException.class);
        } catch (IllegalStateException ise) {
            throw (IllegalStateRuntimeException) JmsErrorUtils.getJMS2Exception(ise, IllegalStateRuntimeException.class);
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "setClientID");
        }

    }
812913
def _handle_exception(self, sender, exception=None):
        
        honeybadger.notify(exception)
        if self.reset_context_after_request:
            self._reset_context()
196290
def _error_handler(data, unique_id):
        
        if data.get('statusCode') == 'FAILURE':
            logger.error('[Subscription: %s] %s: %s' % (unique_id, data.get('errorCode'), data.get('errorMessage')))
            if data.get('connectionClosed'):
                return True
        if data.get('status'):
            # Clients shouldn't disconnect if status 503 is returned; when the stream
            # recovers updates will be sent containing the latest data
            logger.warning('[Subscription: %s] status: %s' % (unique_id, data['status']))
438697
def client_id(self, client):
        

        params = {
            "name": client
        }

        response = self._get(url.clients, params=params)
        self._check_response(response, 200)
        return self._create_response(response).get("client_id")
425643
def defines(self, id, domain='messages'):
        
        assert isinstance(id, (str, unicode))
        assert isinstance(domain, (str, unicode))

        return id in self.messages.get(domain, {})
1148195
@Override
	public String getClientID() throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        if (clientID == null)
	            throw new InvalidClientIDException("Client ID not set");
	        return clientID;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
785904
public synchronized void register( String clientID ) throws InvalidClientIDException
    {
        if (!clientIDs.add(clientID))
        {
            log.error("Client ID already exists : "+clientID);
            throw new InvalidClientIDException("Client ID already exists : "+clientID);
        }
        log.debug("Registered clientID : "+clientID);
    }
612581
public void setClientID(String clientID) {
        if (clientID == null || clientID.isEmpty()) {
            this.clientID = DEFAULT_CLIENT_ID;
            return;
        }
        this.clientID = clientID;
    }
197394
def has_client_id(self, id):
    """"""

    return self.query(Client).filter(Client.id==id).count() != 0
802298
def _coerce_client_id(client_id):
    
    if isinstance(client_id, type(u'')):
        client_id = client_id.encode('utf-8')
    if not isinstance(client_id, bytes):
        raise TypeError('{!r} is not a valid consumer group (must be'
                        ' str or bytes)'.format(client_id))
    return client_id
893187
function Request(event) {
    var id = event.data.id;
    if (id == null) throw new Error("No ID for message " + JSON.stringify(event.data));

    this.data = messages.decode(event.data);
    this.id = this.data.id;
  }
1259487
def init_client(client_id):
    
    if client_id not in drivers:
        drivers[client_id] = init_driver(client_id)
    return drivers[client_id]
764881
public static void validateServiceInstanceID(String id) throws ServiceException {
        if (!validateRequiredField(id, idRegEx)) {
            throw new ServiceException(
                    ErrorCode.SERVICE_INSTANCE_ID_FORMAT_ERROR);
        }
    }
75385
void unfixClientID() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "unfixClientID");

        synchronized (stateLock) {
            clientIDFixed = false;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "unfixClientID");
    }
1075227
def req(self, message_id, timeout):
        ''''''
        return self.send(constants.REQ + ' ' + message_id + ' ' + str(timeout))