Skip to content

Commit 7a79db0

Browse files
committed
fix(.NET): Improve Collection of Errors string
1 parent fe03425 commit 7a79db0

File tree

8 files changed

+226
-4
lines changed

8 files changed

+226
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs
2+
index 84d4af9e..ca3d3174 100644
3+
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs
4+
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs
5+
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb
6+
public class CollectionOfErrors : Exception
7+
{
8+
public readonly System.Collections.Generic.List<Exception> list;
9+
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
10+
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
11+
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
12+
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
13+
+ private static string ListAsString(List<Exception> list)
14+
+ {
15+
+ if (list.Count < 1) return "";
16+
+ string[] msgArr = new string[list.Count];
17+
+ for (int i = 0; i < list.Count; i++)
18+
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
19+
+ return String.Join("\n\t", msgArr);
20+
+ }
21+
}
22+
23+
}
24+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs
25+
index 168c3a3d..b0542873 100644
26+
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs
27+
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs
28+
@@ -7,10 +7,43 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb
29+
{
30+
public static class TypeConversion
31+
{
32+
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z";
33+
-
34+
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z";
35+
+ // BEGIN MANUAL EDIT
36+
+ public static AWS.Cryptography.KeyStore.KeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S17_KeyStoreReference(software.amazon.cryptography.keystore.internaldafny.types.IKeyStoreClient value)
37+
+ {
38+
+ if (value is software.amazon.cryptography.keystore.internaldafny.types.IKeyStoreClient dafnyValue)
39+
+ {
40+
+ return new AWS.Cryptography.KeyStore.KeyStore(dafnyValue);
41+
+ }
42+
+ throw new System.ArgumentException("Custom implementations of AWS.Cryptography.KeyStore.KeyStore are not supported yet");
43+
+ }
44+
+ public static software.amazon.cryptography.keystore.internaldafny.types.IKeyStoreClient ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S17_KeyStoreReference(AWS.Cryptography.KeyStore.KeyStore value)
45+
+ {
46+
+ if (value is AWS.Cryptography.KeyStore.KeyStore nativeValue)
47+
+ {
48+
+ return nativeValue.impl();
49+
+ }
50+
+ throw new System.ArgumentException("Custom implementations of AWS.Cryptography.KeyStore.KeyStore are not supported yet");
51+
+ }
52+
+ public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.ILegacyDynamoDbEncryptor FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S32_LegacyDynamoDbEncryptorReference(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor value)
53+
+ {
54+
+ if (value is NativeWrapper_LegacyDynamoDbEncryptor nativeWrapper) return nativeWrapper._impl;
55+
+ return new LegacyDynamoDbEncryptor(value);
56+
57+
+ }
58+
+ public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S32_LegacyDynamoDbEncryptorReference(AWS.Cryptography.DbEncryptionSDK.DynamoDb.ILegacyDynamoDbEncryptor value)
59+
+ {
60+
+ switch (value)
61+
+ {
62+
+ case LegacyDynamoDbEncryptor valueWithImpl:
63+
+ return valueWithImpl._impl;
64+
+ case LegacyDynamoDbEncryptorBase nativeImpl:
65+
+ return new NativeWrapper_LegacyDynamoDbEncryptor(nativeImpl);
66+
+ default:
67+
+ throw new System.ArgumentException(
68+
+ "Custom implementations of LegacyDynamoDbEncryptor must extend LegacyDynamoDbEncryptorBase.");
69+
+ }
70+
+ }
71+
+ // END MANUAL EDIT
72+
public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconKeySource value)
73+
{
74+
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource)value;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs
2+
index 6e2cf219..8fdaf86e 100644
3+
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs
4+
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs
5+
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.Transforms
6+
public class CollectionOfErrors : Exception
7+
{
8+
public readonly System.Collections.Generic.List<Exception> list;
9+
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
10+
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
11+
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
12+
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
13+
+ private static string ListAsString(List<Exception> list)
14+
+ {
15+
+ if (list.Count < 1) return "";
16+
+ string[] msgArr = new string[list.Count];
17+
+ for (int i = 0; i < list.Count; i++)
18+
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
19+
+ return String.Join("\n\t", msgArr);
20+
+ }
21+
}
22+
23+
}
24+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs
25+
index 56470621..95841aee 100644
26+
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs
27+
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs
28+
@@ -7,10 +7,6 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.Transforms
29+
{
30+
public static class TypeConversion
31+
{
32+
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z";
33+
-
34+
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z";
35+
-
36+
public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbTablesEncryptionConfig FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_DynamoDbTablesEncryptionConfig(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IDynamoDbTablesEncryptionConfig value)
37+
{
38+
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbTablesEncryptionConfig converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbTablesEncryptionConfig(); converted.TableEncryptionConfigs = (System.Collections.Generic.Dictionary<string, AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbTableEncryptionConfig>)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_DynamoDbTablesEncryptionConfig__M22_tableEncryptionConfigs(concrete._tableEncryptionConfigs); return converted;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs
2+
index ef0d4752..acc77d97 100644
3+
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs
4+
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs
5+
@@ -8,9 +8,18 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor
6+
public class CollectionOfErrors : Exception
7+
{
8+
public readonly System.Collections.Generic.List<Exception> list;
9+
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
10+
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
11+
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
12+
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
13+
+
14+
+ private static string ListAsString(List<Exception> list)
15+
+ {
16+
+ if (list.Count < 1) return "";
17+
+ string[] msgArr = new string[list.Count];
18+
+ for (int i = 0; i < list.Count; i++)
19+
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
20+
+ return String.Join("\n\t", msgArr);
21+
+ }
22+
}
23+
24+
}
25+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs
26+
index d1ceb19b..f96612ee 100644
27+
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs
28+
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs
29+
@@ -7,10 +7,6 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor
30+
{
31+
public static class TypeConversion
32+
{
33+
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z";
34+
-
35+
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z";
36+
-
37+
public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.DecryptItemInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N13_itemEncryptor__S16_DecryptItemInput(software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types._IDecryptItemInput value)
38+
{
39+
software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.DecryptItemInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.DecryptItemInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.DecryptItemInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.DecryptItemInput(); converted.EncryptedItem = (System.Collections.Generic.Dictionary<string, Amazon.DynamoDBv2.Model.AttributeValue>)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N13_itemEncryptor__S16_DecryptItemInput__M13_encryptedItem(concrete._encryptedItem); return converted;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs
2+
index 0f4c3ff9..a966d3aa 100644
3+
--- b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs
4+
+++ a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs
5+
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.StructuredEncryption
6+
public class CollectionOfErrors : Exception
7+
{
8+
public readonly System.Collections.Generic.List<Exception> list;
9+
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
10+
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
11+
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
12+
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
13+
+ private static string ListAsString(List<Exception> list)
14+
+ {
15+
+ if (list.Count < 1) return "";
16+
+ string[] msgArr = new string[list.Count];
17+
+ for (int i = 0; i < list.Count; i++)
18+
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
19+
+ return String.Join("\n\t", msgArr);
20+
+ }
21+
}
22+
23+
}
24+
diff --git b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs
25+
index 6de665f3..6a802466 100644
26+
--- b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs
27+
+++ a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs
28+
@@ -7,10 +7,6 @@ namespace AWS.Cryptography.DbEncryptionSDK.StructuredEncryption
29+
{
30+
public static class TypeConversion
31+
{
32+
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z";
33+
-
34+
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z";
35+
-
36+
public static AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.AuthenticateAction FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N20_structuredEncryption__S18_AuthenticateAction(software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types._IAuthenticateAction value)
37+
{
38+
if (value.is_SIGN) return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.AuthenticateAction.SIGN;

DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb
88
public class CollectionOfErrors : Exception
99
{
1010
public readonly System.Collections.Generic.List<Exception> list;
11-
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
11+
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
1212
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
1313
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
14+
private static string ListAsString(List<Exception> list)
15+
{
16+
if (list.Count < 1) return "";
17+
string[] msgArr = new string[list.Count];
18+
for (int i = 0; i < list.Count; i++)
19+
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
20+
return String.Join("\n\t", msgArr);
21+
}
1422
}
1523

1624
}

DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.Transforms
88
public class CollectionOfErrors : Exception
99
{
1010
public readonly System.Collections.Generic.List<Exception> list;
11-
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
11+
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
1212
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
1313
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
14+
private static string ListAsString(List<Exception> list)
15+
{
16+
if (list.Count < 1) return "";
17+
string[] msgArr = new string[list.Count];
18+
for (int i = 0; i < list.Count; i++)
19+
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
20+
return String.Join("\n\t", msgArr);
21+
}
1422
}
1523

1624
}

DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor
88
public class CollectionOfErrors : Exception
99
{
1010
public readonly System.Collections.Generic.List<Exception> list;
11-
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
11+
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
1212
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
1313
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
14+
15+
private static string ListAsString(List<Exception> list)
16+
{
17+
if (list.Count < 1) return "";
18+
string[] msgArr = new string[list.Count];
19+
for (int i = 0; i < list.Count; i++)
20+
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
21+
return String.Join("\n\t", msgArr);
22+
}
1423
}
1524

1625
}

DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.StructuredEncryption
88
public class CollectionOfErrors : Exception
99
{
1010
public readonly System.Collections.Generic.List<Exception> list;
11-
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
11+
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
1212
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
1313
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
14+
private static string ListAsString(List<Exception> list)
15+
{
16+
if (list.Count < 1) return "";
17+
string[] msgArr = new string[list.Count];
18+
for (int i = 0; i < list.Count; i++)
19+
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
20+
return String.Join("\n\t", msgArr);
21+
}
1422
}
1523

1624
}

0 commit comments

Comments
 (0)