Skip to content

Commit

Permalink
fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ltamaster committed Oct 28, 2019
1 parent 91a927c commit b2162a5
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,23 @@ public void executeNodeStep(PluginStepContext context, Map<String, Object> confi
String headers = configuration.containsKey("headers") ? configuration.get("headers").toString() : null;
String body = configuration.containsKey("body") ? configuration.get("body").toString() : null;

log.log(5, "remoteUrl: " + remoteUrl);
log.log(5, "method: " + method);
log.log(5, "headers: " + headers);
log.log(5, "timeout: " + timeout);

if(remoteUrl == null || method == null) {
throw new NodeStepException("Remote URL and Method are required.", StepFailureReason.ConfigurationFailure, entry.getNodename());
}

//Use options in remote URL
if (null != remoteUrl && remoteUrl.contains("${")) {
remoteUrl = DataContextUtils.replaceDataReferences(remoteUrl, context.getDataContext());
remoteUrl = DataContextUtils.replaceDataReferencesInString(remoteUrl, context.getDataContextObject());
}

//Use options in body
if (null != body && body.contains("${")) {
body = DataContextUtils.replaceDataReferences(body, context.getDataContext());
body = DataContextUtils.replaceDataReferencesInString(body, context.getDataContextObject());
}

HttpBuilder builder = new HttpBuilder();
Expand All @@ -98,7 +103,7 @@ public void executeNodeStep(PluginStepContext context, Map<String, Object> confi
try {
authHeader = builder.getAuthHeader(context, configuration);
} catch (StepException e) {
throw new NodeStepException("Remote URL and Method are required.", e.getFailureReason(), entry.getNodename());
throw new NodeStepException(e.getMessage(), e.getFailureReason(), entry.getNodename());
}

if(authHeader != null) {
Expand All @@ -125,7 +130,7 @@ public void executeNodeStep(PluginStepContext context, Map<String, Object> confi
try {
builder.doRequest(configuration, request.build(), 1);
} catch (StepException e) {
throw new NodeStepException("Remote URL and Method are required.", e.getFailureReason(), entry.getNodename());
throw new NodeStepException(e.getMessage(), e.getFailureReason(), entry.getNodename());
}

}
Expand Down

0 comments on commit b2162a5

Please sign in to comment.