Beispiel #1
0
 public void AddError(string errorsString, bool checkForInnerErrorDuplicates)
 {
     if (string.IsNullOrEmpty(errorsString))
     {
         return;
     }
     if (checkForInnerErrorDuplicates && errorsString.IsMultipleXElement(out XElement output))
     {
         var xmlInnerErrors = output.Elements("InnerError");
         if (xmlInnerErrors.Count() > 0)
         {
             foreach (XElement element in xmlInnerErrors)
             {
                 Errors.AddItem(element.Value, true);
             }
         }
         else if (errorsString.IsJToken(out JToken outputJObject))
         {
             var jsonInnerErrors = outputJObject.ToObject(typeof(List <string>)) as List <string>;
             if (jsonInnerErrors != null)
             {
                 foreach (var error in jsonInnerErrors)
                 {
                     Errors.AddItem(error);
                 }
             }
         }
     }
     else
     {
         Errors.Add(errorsString);
     }
 }
Beispiel #2
0
 public ErrorDto(string code, string description)
     : this()
 {
     Errors.AddItem(string.Empty, new ErrorDetailDto(code, description));
 }