Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Commit

Permalink
added connectionId to WebSocketClientGoneException
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed May 24, 2019
1 parent f210f25 commit c0cf637
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void send(String connectionId, InputStream payload) {
@Override
public AmazonClientException handle(HttpResponse response) throws Exception {
if (response.getStatusCode() == 410) {
return new WebSocketClientGoneException("WebSocket client with id " + connectionId + " is already gone");
return new WebSocketClientGoneException(connectionId, "WebSocket client with id " + connectionId + " is already gone");
}
return new AmazonClientException("Exception publishing messages to WS endpoint "
+ " POST " + url + " "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@

public class WebSocketClientGoneException extends AmazonClientException {

public WebSocketClientGoneException(String message, Throwable t) {
private final String connectionId;

public WebSocketClientGoneException(String connectionId, String message, Throwable t) {
super(message, t);
this.connectionId = connectionId;
}

public WebSocketClientGoneException(String message) {
public WebSocketClientGoneException(String connectionId, String message) {
super(message);
this.connectionId = connectionId;
}

public WebSocketClientGoneException(Throwable t) {
public WebSocketClientGoneException(String connectionId, Throwable t) {
super(t);
this.connectionId = connectionId;
}

public String getConnectionId() {
return connectionId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class MessageSenderSpec extends Specification {
when:
defaultSender.send(CONNECTION_ID, PAYLOAD)
then:
thrown(WebSocketClientGoneException)
WebSocketClientGoneException e = thrown(WebSocketClientGoneException)
e.connectionId == CONNECTION_ID
}

void 'test forbidden'() {
Expand Down

0 comments on commit c0cf637

Please sign in to comment.