Skip to content

Commit

Permalink
[chore](fe) Improve error msg about fe name format
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter committed Jul 22, 2024
1 parent 4cc4944 commit 7841eaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ public enum ErrorCode {
ERR_CLUSTER_ALTER_BE_IN_DECOMMISSION(5059, new byte[]{'4', '2', '0', '0', '0'},
"Cluster '%s' has backends in decommission"),
ERR_WRONG_NAME_FORMAT(5063, new byte[]{'4', '2', '0', '0', '0'},
"Incorrect %s name '%s'"),
"Incorrect %s name '%s', required format is '%s'"),
ERR_COMMON_ERROR(5064, new byte[]{'4', '2', '0', '0', '0'},
"%s"),
ERR_COLOCATE_FEATURE_DISABLED(5063, new byte[]{'4', '2', '0', '0', '0'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@ public static void checkWorkloadSchedPolicyName(String policyName) throws Analys
}

public static void checkCommonName(String type, String name) throws AnalysisException {
if (Strings.isNullOrEmpty(name) || !name.matches(getCommonNameRegex())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, name);
final String regex = getCommonNameRegex();
if (Strings.isNullOrEmpty(name) || !name.matches(regex)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, name, regex);
}
}

public static void checkOutfileSuccessFileName(String type, String name) throws AnalysisException {
if (Strings.isNullOrEmpty(name) || !name.matches(getOutfileSuccessFileNameRegex())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, name);
final String regex = getOutfileSuccessFileNameRegex();
if (Strings.isNullOrEmpty(name) || !name.matches(regex)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, name, regex);
}
}

Expand Down

0 comments on commit 7841eaa

Please sign in to comment.