Skip to content

Commit

Permalink
fix exit code on failed solution validation (fsoc-116) (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnickolov authored Mar 3, 2023
1 parent 96cbcec commit e2b2fa3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/solution/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func validateSolution(cmd *cobra.Command, args []string) {

err = api.HTTPPost(getSolutionValidateUrl(), body.Bytes(), &res, &api.Options{Headers: headers})
if err != nil {
log.Fatalf("Solution validate command failed: %v", err)
log.Fatalf("Solution validate request failed: %v", err)
}

if res.Valid {
Expand All @@ -132,6 +132,9 @@ func validateSolution(cmd *cobra.Command, args []string) {
message = getSolutionValidationErrorsString(res.Errors.Total, res.Errors)
}
output.PrintCmdStatus(cmd, message)
if !res.Valid {
log.Fatalf("%d error(s) found while validating the solution", res.Errors.Total)
}
}

func getSolutionValidationErrorsString(total int, errors Errors) string {
Expand Down

0 comments on commit e2b2fa3

Please sign in to comment.