Skip to content

Commit

Permalink
Properly throw UnregisteredUserException in SignalServicePipe.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Jun 11, 2020
1 parent 400c592 commit 8891b6c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
import org.whispersystems.signalservice.api.push.exceptions.NotFoundException;
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
import org.whispersystems.signalservice.api.util.CredentialsProvider;
import org.whispersystems.signalservice.internal.push.AttachmentV2UploadAttributes;
import org.whispersystems.signalservice.internal.push.AttachmentV3UploadAttributes;
Expand Down Expand Up @@ -180,7 +181,9 @@ public Future<SendMessageResponse> send(OutgoingPushMessageList list, Optional<U
ListenableFuture<WebsocketResponse> response = websocket.sendRequest(requestMessage);

return FutureTransformers.map(response, value -> {
if (value.getStatus() < 200 || value.getStatus() >= 300) {
if (value.getStatus() == 404) {
throw new UnregisteredUserException(list.getDestination(), new NotFoundException("not found"));
} else if (value.getStatus() < 200 || value.getStatus() >= 300) {
throw new IOException("Non-successful response: " + value.getStatus());
}

Expand Down

0 comments on commit 8891b6c

Please sign in to comment.