-
Notifications
You must be signed in to change notification settings - Fork 292
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
Should AlwaysEncryptedAttestationException be public? #1501
Comments
I see no reason why it can't be public. I think this driver is the only one that throws this kind of exception. Thoughts @David-Engel? |
@johnnypham I always hesitate when considering adding new public surface area. Why wouldn't we catch that and instead throw a SqlException? I don't think AlwaysEncryptedAttestationException was meant to be exposed publicly. |
I thought SqlException should only be thrown when the data source generates an error. But I see that JDBC just throws an SqlServerException with an error number of zero, so we could just do that. AlwaysEncryptedAttestationException would be unused then and could be removed. |
Thanks for the quick reviews! Much appreciated. I wasn't too keen on just jumping to public also, otherwise I would have just submitted a pull request. As I was researching this, I did find this code analysis rule. But the odd thing is, that rule isn't triggered on code analysis - I guess because the exceptions are public themselves. But in any case, throwing a SqlException (with appropriate details to allow detection as a transient error) would meet my needs. |
@johnnypham @David-Engel Just wanted to touch base on this one. We're sprucing up error handling code before going live with a new web app and this one is a bit of a blocker for us. We believer we have a workaround for the specific exception noted (we're going to try catching the inner TaskCanceledException) but if anything else causes AlwaysEncryptedAttestationException we won't be able to determine if it's a hard or transient failure. If there's any possibility of a patch for SqlClient being available soon, I would most likely want to push back my release accordingly. Thanks again! |
@kmscode note that as a workaround you can always invoke |
@roji yes - this was discussed also and will likely be done as well (I think the exact words used during my teams discussion was "ugly" but "not pretty" is nicer 😄). The specifically received exception and the TaskCanceledException will be getting added to our transient error handling code. The rest will be treated as hard failures for log reviews should we ever encounter them - 🤞 hopefully we don't! |
I have some changes almost ready (here) that replace all instances of AlwaysEncryptedAttestationException with SqlException. Most of them don't seem to be transient errors. However, since the classes that throw them are not public, there's no documentation available that explains the exceptions thrown for each error scenario. You can go through the changes and see how you'd want to handle them. |
@johnnypham Thanks! I think this solves the problem since we can catch SqlException easily - then we'd have to update our transient error detection logic - which may still require looking to the inner exception - based on your comments above. But at least this would be a good change for anyone using Secure Enclaves to be able to easily catch/attempt to handle these exceptions. Thanks again! |
This fix alone probably won't warrant a hotfix/patch. If we release a hotfix before the GA release in May (none planned as of now), then this can be included in the hotfix. It'll be in a preview release if you're willing to take a dependency on a preview version. If so, we can definitely prioritize it for the next preview release. |
Closing the issue as the fix was released in the GA. |
Reference file: src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AlwaysEncryptedAttestationException.cs
Intermittently / Randomly (though more frequently when attempting to stress test my applications code I will receive the below AlwaysEncryptedAttestationException. However, I cannot directly catch this specific exception - I assume due to the class being internal.
Ideally I would like to retry in such a scenario.
Should this class be public?
The text was updated successfully, but these errors were encountered: