Add debug string on checkArgument failure

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184838852
This commit is contained in:
guyben 2018-02-07 08:04:28 -08:00 committed by jianglai
parent afcae8cf31
commit 90a4809862

View file

@ -271,7 +271,11 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
checkArgument(roidSuffix == null || tlds.size() == 1,
"Can't update roid suffixes on multiple TLDs simultaneously");
for (String tld : tlds) {
checkArgument(tld.equals(canonicalizeDomainName(tld)));
checkArgument(
tld.equals(canonicalizeDomainName(tld)),
"TLD '%s' should be given in the canonical form '%s'",
tld,
canonicalizeDomainName(tld));
checkArgument(
!CharMatcher.javaDigit().matches(tld.charAt(0)),
"TLDs cannot begin with a number");