Skip to content

Commit

Permalink
fix(pipeline): Bring back template validation messages in Deck (#4061)
Browse files Browse the repository at this point in the history
* fix(pipeline): Bring back template validation messages in Deck

Template validation errors are supposed to bubble up to the surface, but this broke in #3835. This PR brings them back.

* Trigger new build

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Chris Thielen <christopherthielen@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 4, 2021
1 parent 06709b0 commit f0d5477
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 f0d5477

Please sign in to comment.