mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Throw ApiException when adding contact is not successful
This commit is contained in:
@@ -108,7 +108,7 @@ class MailboxApiImpl implements MailboxApi {
|
||||
OkHttpClient client = httpClientProvider.get();
|
||||
Response response = client.newCall(request).execute();
|
||||
if (response.code() == 409) throw new TolerableFailureException();
|
||||
if (!response.isSuccessful()) throw new IOException();
|
||||
if (!response.isSuccessful()) throw new ApiException();
|
||||
}
|
||||
|
||||
private Request.Builder getRequestBuilder(String token) {
|
||||
|
||||
@@ -9,8 +9,6 @@ import org.briarproject.bramble.mailbox.MailboxApi.TolerableFailureException;
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
@@ -200,7 +198,7 @@ public class MailboxApiTest extends BrambleTestCase {
|
||||
assertEquals(expected, request1.getBody().readUtf8());
|
||||
|
||||
// request is not successful
|
||||
assertThrows(IOException.class, () ->
|
||||
assertThrows(ApiException.class, () ->
|
||||
api.addContact(properties, mailboxContact));
|
||||
RecordedRequest request2 = server.takeRequest();
|
||||
assertEquals("/contacts", request2.getPath());
|
||||
|
||||
Reference in New Issue
Block a user