Improve message if submit fails due to non-fulfilled submit requirements
If a submit request fails due to non-fulfilled submit requirements, the response only contains the fallback text of the submit requirement. Without letting the user know that this message is about a non-fulfilled submit requirement, the message may be unclear to the caller. The fallback text is usually kept as short as possible, since the frontend is displaying it in the UI. Hence it cannot be made more verbose without affecting the UI. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Iecd9304aa98efa6f404da9a50d2e002c6aefc6f3
This commit is contained in:
@@ -352,7 +352,7 @@ public class MergeOp implements AutoCloseable {
|
||||
}
|
||||
if (record.requirements != null) {
|
||||
record.requirements.stream()
|
||||
.map(SubmitRequirement::fallbackText)
|
||||
.map(MergeOp::describeSubmitRequirement)
|
||||
.forEach(blockingConditions::add);
|
||||
}
|
||||
return Joiner.on("; ").join(blockingConditions);
|
||||
@@ -388,6 +388,10 @@ public class MergeOp implements AutoCloseable {
|
||||
return Joiner.on("; ").join(labelResults);
|
||||
}
|
||||
|
||||
private static String describeSubmitRequirement(SubmitRequirement submitRequirement) {
|
||||
return String.format("Submit requirement not fulfilled: %s", submitRequirement.fallbackText());
|
||||
}
|
||||
|
||||
private void checkSubmitRulesAndState(ChangeSet cs, boolean allowMerged)
|
||||
throws ResourceConflictException {
|
||||
checkArgument(
|
||||
|
||||
Reference in New Issue
Block a user