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

status: Introduce FromContextError convenience function #2057

Merged
merged 1 commit into from
May 10, 2018

Conversation

dfawley
Copy link
Member

@dfawley dfawley commented May 9, 2018

With the removal of auto-converting context (and other) errors from service handlers in #1881, the expected application code when checking context and returning status errors based on it is fairly verbose. With this function, it is simplified to:

if err := ctx.Err(); err != nil {
  return status.FromContextError(err).Err()
}

@dfawley dfawley added the Type: Feature New features or improvements in behavior label May 9, 2018
@dfawley dfawley requested review from jeanbza and MakMukhi May 9, 2018 18:44
@dfawley dfawley added this to the 1.13 Release milestone May 9, 2018
@dfawley dfawley merged commit d07538b into grpc:master May 10, 2018
dfawley added a commit to dfawley/grpc-go that referenced this pull request May 11, 2018
@dfawley dfawley deleted the ctx_to_status branch July 6, 2018 18:05
@lock lock bot locked as resolved and limited conversation to collaborators Jan 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants