Provide a nicer error message for CLA failure

Change-Id: I001f9ef3d428771a77f0d881877e8bf590d91448
This commit is contained in:
Han-Wen Nienhuys
2018-07-09 15:19:43 +02:00
parent 663cbed426
commit c12ddc3b23
2 changed files with 8 additions and 4 deletions

View File

@@ -108,7 +108,11 @@ public class ContributorAgreementsChecker {
if (!iUser.getEffectiveGroups().containsAnyOf(okGroupIds)) {
final StringBuilder msg = new StringBuilder();
msg.append("A Contributor Agreement must be completed before uploading");
msg.append("No Contributor Agreement on file for user ")
.append(iUser.getNameEmail())
.append(" (id=")
.append(iUser.getAccountId())
.append(")");
if (canonicalWebUrl != null) {
msg.append(":\n\n ");
msg.append(canonicalWebUrl);

View File

@@ -177,7 +177,7 @@ public class AgreementsIT extends AbstractDaemonTest {
setApiUser(user);
setUseContributorAgreements(InheritableBoolean.TRUE);
exception.expect(AuthException.class);
exception.expectMessage("A Contributor Agreement must be completed");
exception.expectMessage("Contributor Agreement");
gApi.changes().id(change.changeId).revert();
}
@@ -209,7 +209,7 @@ public class AgreementsIT extends AbstractDaemonTest {
in.destination = dest.ref;
in.message = change.subject;
exception.expect(AuthException.class);
exception.expectMessage("A Contributor Agreement must be completed");
exception.expectMessage("Contributor Agreement");
gApi.changes().id(change.changeId).current().cherryPick(in);
}
@@ -227,7 +227,7 @@ public class AgreementsIT extends AbstractDaemonTest {
gApi.changes().create(newChangeInput());
fail("Expected AuthException");
} catch (AuthException e) {
assertThat(e.getMessage()).contains("A Contributor Agreement must be completed");
assertThat(e.getMessage()).contains("Contributor Agreement");
}
// Sign the agreement