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 5949a1c commit 4a06bad
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
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,10 @@ 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 4a06bad

Please sign in to comment.