Search in sources :

Example 1 with SaslMechanismsListingFailedEvent

use of com.couchbase.client.core.cnc.events.io.SaslMechanismsListingFailedEvent in project couchbase-jvm-clients by couchbase.

the class SaslListMechanismsHandler method failConnection.

/**
 * Helper method to fail the connection due to an unsuccessful sasl list mechs event.
 *
 * @param message the message that should be part of the error
 * @param status the status code from the memcached response
 * @param duration the duration how long it took overall
 */
private void failConnection(final String message, final short status, final Optional<Duration> duration) {
    KeyValueIoErrorContext errorContext = new KeyValueIoErrorContext(MemcacheProtocol.decodeStatus(status), endpointContext, null);
    ioContext.environment().eventBus().publish(new SaslMechanismsListingFailedEvent(duration.orElse(Duration.ZERO), errorContext, message));
    interceptedConnectPromise.tryFailure(new AuthenticationFailureException(message, errorContext, null));
}
Also used : KeyValueIoErrorContext(com.couchbase.client.core.error.context.KeyValueIoErrorContext) SaslMechanismsListingFailedEvent(com.couchbase.client.core.cnc.events.io.SaslMechanismsListingFailedEvent) AuthenticationFailureException(com.couchbase.client.core.error.AuthenticationFailureException)

Aggregations

SaslMechanismsListingFailedEvent (com.couchbase.client.core.cnc.events.io.SaslMechanismsListingFailedEvent)1 AuthenticationFailureException (com.couchbase.client.core.error.AuthenticationFailureException)1 KeyValueIoErrorContext (com.couchbase.client.core.error.context.KeyValueIoErrorContext)1