-
Notifications
You must be signed in to change notification settings - Fork 362
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
feat: Exposed RpcException property to SpannerException #9527
Conversation
@@ -93,6 +93,11 @@ public bool IsRetryable | |||
/// </summary> | |||
public TimeSpan? RecommendedRetryDelay { get; } | |||
|
|||
/// <summary> | |||
/// Gets the underlying <see cref="Grpc.Core.RpcException"/>. |
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.
I would reword "Gets" to "Returns", but more importantly point out that this may be null, if the SpannerException was not caused by an RpcException.
namespace Google.Cloud.Spanner.Data.Tests; | ||
public class SpannerExceptionTests | ||
{ | ||
private static readonly Status s_status = new Status(StatusCode.InvalidArgument, "Bad request"); |
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.
Just move into the single test that uses it, as a local variable?
public void SpannerExceptionContainsRpcExceptionAsInnerException() | ||
{ | ||
var rpcExceptionMessage = "Test RpcException Message"; | ||
var rpcexception = new RpcException(s_status, rpcExceptionMessage); |
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.
Nit: rename to rpcException
.
|
||
var spannerExceptionWithoutInnerExcpetion = new SpannerException(ErrorCode.InvalidArgument, "Invalid Argument Message"); | ||
|
||
Assert.NotNull(spannerExceptionWithInnerExcpetion_1.RpcException); |
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.
I think these can just be Assert.Same(rpcException, spannerExceptionWithInnerExcpetion_1.RpcException);
var rpcExceptionMessage = "Test RpcException Message"; | ||
var rpcexception = new RpcException(s_status, rpcExceptionMessage); | ||
|
||
var spannerExceptionWithInnerExcpetion_1 = new SpannerException(rpcexception); |
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.
Nit: Excpetion => Exception, and I'd lose the underscores.
Changes in Google.Cloud.Spanner.Data version 4.3.0: - Enable REST transport in C# ([commit f6a1c3e](f6a1c3e)) - Exposed RpcException property to SpannerException ([issue 9527](#9527)) ([commit 4c96a04](4c96a04)) Packages in this release: - Release Google.Cloud.Spanner.Admin.Database.V1 version 4.3.0 - Release Google.Cloud.Spanner.Admin.Instance.V1 version 4.3.0 - Release Google.Cloud.Spanner.Common.V1 version 4.3.0 - Release Google.Cloud.Spanner.Data version 4.3.0 - Release Google.Cloud.Spanner.V1 version 4.3.0
In this PR we have exposed InnerException of SpannerException via RpcException property.