-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(.NET): Improve Collection of Errors string #1534
Open
texastony
wants to merge
1
commit into
main
Choose a base branch
from
tony/fix-collectionOfErrors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+226
−4
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
DynamoDbEncryption/codegen-patches/DynamoDbEncryption/dotnet/dafny-4.9.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs | ||
index 84d4af9e..ca3d3174 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/CollectionOfErrors.cs | ||
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb | ||
public class CollectionOfErrors : Exception | ||
{ | ||
public readonly System.Collections.Generic.List<Exception> list; | ||
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; } | ||
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; } | ||
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); } | ||
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); } | ||
+ private static string ListAsString(List<Exception> list) | ||
+ { | ||
+ if (list.Count < 1) return ""; | ||
+ string[] msgArr = new string[list.Count]; | ||
+ for (int i = 0; i < list.Count; i++) | ||
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}"; | ||
+ return String.Join("\n\t", msgArr); | ||
+ } | ||
} | ||
|
||
} | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs | ||
index 168c3a3d..b0542873 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs | ||
@@ -7,10 +7,43 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb | ||
{ | ||
public static class TypeConversion | ||
{ | ||
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z"; | ||
- | ||
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z"; | ||
+ // BEGIN MANUAL EDIT | ||
+ 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) | ||
+ { | ||
+ if (value is software.amazon.cryptography.keystore.internaldafny.types.IKeyStoreClient dafnyValue) | ||
+ { | ||
+ return new AWS.Cryptography.KeyStore.KeyStore(dafnyValue); | ||
+ } | ||
+ throw new System.ArgumentException("Custom implementations of AWS.Cryptography.KeyStore.KeyStore are not supported yet"); | ||
+ } | ||
+ 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) | ||
+ { | ||
+ if (value is AWS.Cryptography.KeyStore.KeyStore nativeValue) | ||
+ { | ||
+ return nativeValue.impl(); | ||
+ } | ||
+ throw new System.ArgumentException("Custom implementations of AWS.Cryptography.KeyStore.KeyStore are not supported yet"); | ||
+ } | ||
+ 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) | ||
+ { | ||
+ if (value is NativeWrapper_LegacyDynamoDbEncryptor nativeWrapper) return nativeWrapper._impl; | ||
+ return new LegacyDynamoDbEncryptor(value); | ||
|
||
+ } | ||
+ 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) | ||
+ { | ||
+ switch (value) | ||
+ { | ||
+ case LegacyDynamoDbEncryptor valueWithImpl: | ||
+ return valueWithImpl._impl; | ||
+ case LegacyDynamoDbEncryptorBase nativeImpl: | ||
+ return new NativeWrapper_LegacyDynamoDbEncryptor(nativeImpl); | ||
+ default: | ||
+ throw new System.ArgumentException( | ||
+ "Custom implementations of LegacyDynamoDbEncryptor must extend LegacyDynamoDbEncryptorBase."); | ||
+ } | ||
+ } | ||
+ // END MANUAL EDIT | ||
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) | ||
{ | ||
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource)value; |
38 changes: 38 additions & 0 deletions
38
DynamoDbEncryption/codegen-patches/DynamoDbEncryptionTransforms/dotnet/dafny-4.9.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs | ||
index 6e2cf219..8fdaf86e 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/CollectionOfErrors.cs | ||
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.Transforms | ||
public class CollectionOfErrors : Exception | ||
{ | ||
public readonly System.Collections.Generic.List<Exception> list; | ||
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; } | ||
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; } | ||
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); } | ||
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); } | ||
+ private static string ListAsString(List<Exception> list) | ||
+ { | ||
+ if (list.Count < 1) return ""; | ||
+ string[] msgArr = new string[list.Count]; | ||
+ for (int i = 0; i < list.Count; i++) | ||
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}"; | ||
+ return String.Join("\n\t", msgArr); | ||
+ } | ||
} | ||
|
||
} | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs | ||
index 56470621..95841aee 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs | ||
@@ -7,10 +7,6 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.Transforms | ||
{ | ||
public static class TypeConversion | ||
{ | ||
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z"; | ||
- | ||
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z"; | ||
- | ||
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) | ||
{ | ||
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; |
39 changes: 39 additions & 0 deletions
39
DynamoDbEncryption/codegen-patches/DynamoDbItemEncryptor/dotnet/dafny-4.9.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs | ||
index ef0d4752..acc77d97 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/CollectionOfErrors.cs | ||
@@ -8,9 +8,18 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor | ||
public class CollectionOfErrors : Exception | ||
{ | ||
public readonly System.Collections.Generic.List<Exception> list; | ||
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; } | ||
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; } | ||
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); } | ||
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); } | ||
+ | ||
+ private static string ListAsString(List<Exception> list) | ||
+ { | ||
+ if (list.Count < 1) return ""; | ||
+ string[] msgArr = new string[list.Count]; | ||
+ for (int i = 0; i < list.Count; i++) | ||
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}"; | ||
+ return String.Join("\n\t", msgArr); | ||
+ } | ||
} | ||
|
||
} | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs | ||
index d1ceb19b..f96612ee 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs | ||
@@ -7,10 +7,6 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor | ||
{ | ||
public static class TypeConversion | ||
{ | ||
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z"; | ||
- | ||
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z"; | ||
- | ||
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) | ||
{ | ||
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; |
38 changes: 38 additions & 0 deletions
38
DynamoDbEncryption/codegen-patches/StructuredEncryption/dotnet/dafny-4.9.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs | ||
index 0f4c3ff9..a966d3aa 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/CollectionOfErrors.cs | ||
@@ -8,9 +8,17 @@ namespace AWS.Cryptography.DbEncryptionSDK.StructuredEncryption | ||
public class CollectionOfErrors : Exception | ||
{ | ||
public readonly System.Collections.Generic.List<Exception> list; | ||
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; } | ||
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; } | ||
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); } | ||
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); } | ||
+ private static string ListAsString(List<Exception> list) | ||
+ { | ||
+ if (list.Count < 1) return ""; | ||
+ string[] msgArr = new string[list.Count]; | ||
+ for (int i = 0; i < list.Count; i++) | ||
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}"; | ||
+ return String.Join("\n\t", msgArr); | ||
+ } | ||
} | ||
|
||
} | ||
diff --git b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs | ||
index 6de665f3..6a802466 100644 | ||
--- b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs | ||
+++ a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs | ||
@@ -7,10 +7,6 @@ namespace AWS.Cryptography.DbEncryptionSDK.StructuredEncryption | ||
{ | ||
public static class TypeConversion | ||
{ | ||
- private const string ISO8601DateFormat = "yyyy-MM-dd\\THH:mm:ss.fff\\Z"; | ||
- | ||
- private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\THH:mm:ss\\Z"; | ||
- | ||
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) | ||
{ | ||
if (value.is_SIGN) return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.AuthenticateAction.SIGN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to import
System.Collections.Generic.List
or useSystem.Collections.Generic.List<Exception>
instead ofList<Exception>
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and other places