Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-tkachenko-datadog committed Nov 6, 2024
1 parent b41531a commit df3e530
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public DatadogClient createClient() {
public void validateTracesConnection() throws Descriptor.FormException {
FormValidation connectivityCheckResult = checkTracesConnectivity(agentHost, agentTraceCollectionPort);
if (connectivityCheckResult.kind == FormValidation.Kind.ERROR) {
throw new Descriptor.FormException("CI Visibility connectivity check failed: " + connectivityCheckResult.getMessage(), "ciVisibilityData");
throw new Descriptor.FormException(connectivityCheckResult.getMessage(), "ciVisibilityData");
}
}

private static FormValidation checkTracesConnectivity(String agentHost, Integer agentTraceCollectionPort) {
if (StringUtils.isBlank(agentHost)) {
return FormValidation.error("Host name missing");
return FormValidation.error("Agent host name missing");
}
if (agentTraceCollectionPort == null) {
return FormValidation.error("Trace collection port missing");
Expand All @@ -100,7 +100,7 @@ private static FormValidation checkTracesConnectivity(String agentHost, Integer
return FormValidation.error("The agent returned empty endpoints list");
}
} catch (Exception e) {
return FormValidation.error(e.getMessage());
return FormValidation.error("Traces HTTP connectivity check failed: " + e.getMessage());
}
}

Expand Down

0 comments on commit df3e530

Please sign in to comment.