Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/17/20 17:03:24 (4 years ago)
Author:
dpiringe
Message:

#3026:

  • refactored json item validation process -> every method now returns a ValidationResult containing bool Success (true if validation is successful) and IEnumerable<string> Errors (error messages)
    • this design allows to specify error messages directly in json items
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs

    r17477 r17481  
    6969      // clear all runs
    7070      Optimizer.Runs.Clear();
    71      
    72       IList<IJsonItem> faultyItems = new List<IJsonItem>();
    73      
    74       if (!Root.GetValidator().Validate(ref faultyItems)) {
     71
     72      var validationResult = Root.GetValidator().Validate();
     73      if (!validationResult.Success) {
    7574        IList<Exception> list = new List<Exception>();
    7675        //print faultyItems
    77         foreach (var x in faultyItems) {
    78           list.Add(new Exception($"Combination of value and range is not valid for {x.Name}"));
     76        foreach (var x in validationResult.Errors) {
     77          list.Add(new Exception(x));
    7978        }
    8079        ErrorHandling.ShowErrorDialog(this, new AggregateException(list));
Note: See TracChangeset for help on using the changeset viewer.