Skip to content

Commit

Permalink
fix(pipeline): Bring back template validation messages in Deck
Browse files Browse the repository at this point in the history
Template validation errors are supposed to bubble up to the surface, but this broke in spinnaker#3835. This PR brings them back.
  • Loading branch information
jervi committed Mar 15, 2021
1 parent 041a7ab commit 1dcbfec
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.spectator.api.Registry;
import com.netflix.spinnaker.kork.exceptions.HasAdditionalAttributes;
import com.netflix.spinnaker.kork.exceptions.UserException;
import com.netflix.spinnaker.kork.web.exceptions.ValidationException;
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType;
import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution;
import com.netflix.spinnaker.orca.api.pipeline.models.Trigger;
Expand Down Expand Up @@ -162,12 +162,12 @@ private PipelineExecution handleStartupFailure(PipelineExecution execution, Thro
final String canceledBy = "system";
String reason = "Failed on startup: " + failure.getMessage();

if (failure instanceof ValidationException) {
ValidationException validationException = (ValidationException) failure;
if (validationException.getAdditionalAttributes().containsKey("errors")) {
if (failure instanceof HasAdditionalAttributes) {
HasAdditionalAttributes exceptionWithAttributes = (HasAdditionalAttributes) failure;
if (exceptionWithAttributes.getAdditionalAttributes().containsKey("errors")) {
List<Map<String, Object>> errors =
((List<Map<String, Object>>)
validationException.getAdditionalAttributes().get("errors"));
exceptionWithAttributes.getAdditionalAttributes().get("errors"));
reason +=
errors.stream()
.flatMap(
Expand Down

0 comments on commit 1dcbfec

Please sign in to comment.