Skip to content
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

add Unwrap() method of yoError #35

Merged
merged 3 commits into from
May 2, 2020

Conversation

qua-iy
Copy link
Contributor

@qua-iy qua-iy commented May 1, 2020

Spanner will retry ReadWriteTransaction when transaction was aborted, by checking spanner.Error using Unwrap method. Since yo wraps spanner.Error by yoError, yoError should to support Unwrap() method.

@kazegusuri
Copy link
Collaborator

I think it's okay to add Unwrap() by default. However the Unwrap is not used inside spanner library.
Spanner library uses errors.As() or status.FromError() to know gRPC status code. yoError does not support As(), so returns the original status code by status.FromError(). That's why yoError implements GRPCStatus().

@kazegusuri
Copy link
Collaborator

ah it's my misunderstanding. Unwrap() is called inside errors.As(). LGTM.

@kazegusuri kazegusuri merged commit fa9124e into cloudspannerecosystem:master May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants