-
Notifications
You must be signed in to change notification settings - Fork 435
Add a 'cause' to 'GRPCStatus' #1290
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
Merged
Merged
Conversation
This file contains hidden or 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
Motivation:
In some causes it's useful to know the underlying error which caused an
RPC to complete with a particular status. The current way of achieving
this is by embeddeding it in the status message. While the information
may be relevant to some callers it is noise to others. Moreover, to
those that want the information, they have to know how to search for it
(some strings may embed errors in different ways and so on). This also
precludes them from being able to switch on a particular error type, for
example.
Modifications:
- Add an optional 'cause' field to 'GRPCStatus', an error associated
with the status.
- Adding cause directly into 'GRPCStatus' made it a little too wide so a
backing storage was added for the storage and message. This is a bit
of a shame since we now unconditionally allocate for messages but the
happy path ('ok') should be without message or cause and so should not
allocate.
Result:
- Causal errors can be attached to 'GRPCStatus'
f8f5774 to
f7f36fa
Compare
Lukasa
approved these changes
Oct 6, 2021
Collaborator
Lukasa
left a comment
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.
LGTM, one note about the default value.
glbrntt
commented
Oct 6, 2021
glbrntt
added a commit
to glbrntt/grpc-swift
that referenced
this pull request
Nov 8, 2021
Motivation: In grpc#1290 a 'cause' was added to `GRPCStatus` so use have access the error which resulted in the status. We use the `GRPCStatusTransformable` protocol to transform errors to statuses, but we missed adding passing along the cause in a bunch of places. Modifications: - Add a cause to the status for a handful of additional error types Result: More errors provide a cause when converted to a status
glbrntt
added a commit
that referenced
this pull request
Nov 8, 2021
Motivation: In #1290 a 'cause' was added to `GRPCStatus` so use have access the error which resulted in the status. We use the `GRPCStatusTransformable` protocol to transform errors to statuses, but we missed adding passing along the cause in a bunch of places. Modifications: - Add a cause to the status for a handful of additional error types Result: More errors provide a cause when converted to a status
bimawa
pushed a commit
to StreamLayer/grpc-swift
that referenced
this pull request
Nov 10, 2021
Motivation:
In some causes it's useful to know the underlying error which caused an
RPC to complete with a particular status. The current way of achieving
this is by embeddeding it in the status message. While the information
may be relevant to some callers it is noise to others. Moreover, to
those that want the information, they have to know how to search for it
(some strings may embed errors in different ways and so on). This also
precludes them from being able to switch on a particular error type, for
example.
Modifications:
- Add an optional 'cause' field to 'GRPCStatus', an error associated
with the status.
- Adding cause directly into 'GRPCStatus' made it a little too wide so a
backing storage was added for the storage and message. This is a bit
of a shame since we now unconditionally allocate for messages but the
happy path ('ok') should be without message or cause and so should not
allocate.
Result:
- Causal errors can be attached to 'GRPCStatus'
bimawa
pushed a commit
to StreamLayer/grpc-swift
that referenced
this pull request
Nov 10, 2021
Motivation: In grpc#1290 a 'cause' was added to `GRPCStatus` so use have access the error which resulted in the status. We use the `GRPCStatusTransformable` protocol to transform errors to statuses, but we missed adding passing along the cause in a bunch of places. Modifications: - Add a cause to the status for a handful of additional error types Result: More errors provide a cause when converted to a status
This was referenced Feb 9, 2022
bimawa
pushed a commit
to StreamLayer/grpc-swift
that referenced
this pull request
Jun 17, 2022
Motivation:
In some causes it's useful to know the underlying error which caused an
RPC to complete with a particular status. The current way of achieving
this is by embeddeding it in the status message. While the information
may be relevant to some callers it is noise to others. Moreover, to
those that want the information, they have to know how to search for it
(some strings may embed errors in different ways and so on). This also
precludes them from being able to switch on a particular error type, for
example.
Modifications:
- Add an optional 'cause' field to 'GRPCStatus', an error associated
with the status.
- Adding cause directly into 'GRPCStatus' made it a little too wide so a
backing storage was added for the storage and message. This is a bit
of a shame since we now unconditionally allocate for messages but the
happy path ('ok') should be without message or cause and so should not
allocate.
Result:
- Causal errors can be attached to 'GRPCStatus'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation:
In some causes it's useful to know the underlying error which caused an
RPC to complete with a particular status. The current way of achieving
this is by embeddeding it in the status message. While the information
may be relevant to some callers it is noise to others. Moreover, to
those that want the information, they have to know how to search for it
(some strings may embed errors in different ways and so on). This also
precludes them from being able to switch on a particular error type, for
example.
Modifications:
with the status.
backing storage was added for the storage and message. This is a bit
of a shame since we now unconditionally allocate for messages but the
happy path ('ok') should be without message or cause and so should not
allocate.
Result: