Skip to content

Commit

Permalink
#250 REHA: also log when DSL returns non-OK
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDNoper committed Jan 22, 2024
1 parent 61b7298 commit e4b7134
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/ee/buerokratt/ruuter/domain/DslInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ private void executeStep(String stepName, List<String> stepNames) {
if (!Objects.equals(recursions.get(stepName), getStepMaxRecursions(stepToExecute))) {
try {
stepToExecute.execute(this);
if (getErrorStatus() != null && !getErrorStatus().equals(HttpStatus.OK)) {
logEvent(stepToExecute, "RUNTIME", Thread.currentThread().getStackTrace());
}
} catch (StepExecutionException e) {
logEvent(stepToExecute, "RUNTIME", e.getStackTrace());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.HttpStatus;
import org.springframework.web.client.HttpClientErrorException;

@Slf4j
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.http.HttpStatus;
import org.springframework.web.client.HttpClientErrorException;

import java.util.LinkedHashMap;
import java.util.Map;
Expand All @@ -32,6 +34,10 @@ protected void executeStepAction(DslInstance di) {
di.setReturnStatus(status);
di.setReturnWithWrapper(withWrapper);
di.setReturnValue(di.getScriptingHelper().evaluateScripts(returnValue, di.getContext(), di.getRequestBody(), di.getRequestQuery(), di.getRequestHeaders()));
if (status != 200) {
di.setErrorStatus(HttpStatus.valueOf(status));
di.setErrorMessage(returnValue);
}
}

@Override
Expand Down

0 comments on commit e4b7134

Please sign in to comment.