Skip to content

Commit

Permalink
feat: improve handshake error handling
Browse files Browse the repository at this point in the history
When HelloReply's status is ERROR, throw an exception containing error
detail that can be handled by the caller.
  • Loading branch information
jgiovaresco committed Mar 26, 2024
1 parent f39ce7a commit cb23a08
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -16,7 +16,6 @@
package io.gravitee.exchange.connector.websocket.channel;

import io.gravitee.exchange.api.channel.exception.ChannelException;
import io.gravitee.exchange.api.channel.exception.ChannelInitializationException;
import io.gravitee.exchange.api.command.Command;
import io.gravitee.exchange.api.command.CommandAdapter;
import io.gravitee.exchange.api.command.CommandHandler;
Expand Down Expand Up @@ -75,7 +74,7 @@ public Completable initialize() {
this.targetId = reply.getPayload().getTargetId();
this.active = true;
} else {
throw new ChannelInitializationException("Unable to parse hello reply payload");
throw new WebSocketConnectorException(String.format("Hello handshake failed: %s", reply.getErrorDetails()), false);
}
});
})
Expand Down

0 comments on commit cb23a08

Please sign in to comment.