Skip to content

Commit 0e05ae6

Browse files
committed
fix(.NET): always include listed errors in Collection of Errs msg
1 parent 735f08c commit 0e05ae6

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
4+
45
using System;
5-
using AWS.Cryptography.EncryptionSDK;
6+
using System.Collections.Generic;
7+
68
namespace AWS.Cryptography.EncryptionSDK
79
{
810
public class CollectionOfErrors : Exception
911
{
1012
public readonly System.Collections.Generic.List<Exception> list;
11-
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
13+
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
1214
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
1315
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
16+
17+
private static string ListAsString(List<Exception> list)
18+
{
19+
if (list.Count < 1) return "";
20+
string [] msgArr = new string [list.Count];
21+
for (int i = 0; i < list.Count; i++)
22+
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
23+
return String.Join("\n\t", msgArr);
24+
}
1425
}
1526

1627
}

0 commit comments

Comments
 (0)