ChangeApi.submittedTogether: Do not wrap RestApiException

The RestApiException thrown by SubmittedTogether.apply is more likely
to be useful to the caller.

Change-Id: Ia4597258b5f12d57094e0ecac4742b553ed7e092
This commit is contained in:
Jonathan Nieder
2016-06-16 17:45:10 -07:00
committed by David Pursehouse
parent fd6d983f84
commit 80c3153453
3 changed files with 6 additions and 13 deletions

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.acceptance.server.change;
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.acceptance.GitUtil.pushHead;
import static org.junit.Assert.fail;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.GitUtil;
@@ -24,7 +23,6 @@ import com.google.gerrit.acceptance.TestProjectInput;
import com.google.gerrit.extensions.client.ChangeStatus;
import com.google.gerrit.extensions.client.SubmitType;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.testutil.ConfigSuite;
@@ -134,15 +132,10 @@ public class SubmittedTogetherIT extends AbstractDaemonTest {
setApiUser(user);
if (isSubmitWholeTopicEnabled()) {
try {
gApi.changes().id(id1).submittedTogether();
fail("Expected AuthException");
} catch (RestApiException e) {
// TODO(jrn): fix extension API not to wrap the RestApiException.
assertThat(e.getCause()).isInstanceOf(AuthException.class);
assertThat(e.getCause()).hasMessage(
"change would be submitted with a change that you cannot see");
}
exception.expect(AuthException.class);
exception.expectMessage(
"change would be submitted with a change that you cannot see");
gApi.changes().id(id1).submittedTogether();
} else {
assertSubmittedTogether(id1);
}