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 regression test capturing need for withCause call #460

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

andrewparmet
Copy link
Contributor

Something I noticed when writing #456 is that with the new branch capturing Status exceptions, the existing regression test that I modified to throw a non-status exception is no longer sufficient to ensure the stack trace is available to the interceptor. Concretely, Status.fromThrowable(exception) will always have exception as the cause of the status so long as exception is not a Status exception and has no Status exception in its causal chain.

This PR adds a test covering that case; without the extra withCause call this test will fail.

// the exception should not propagate to the client
assertThat(clientException.cause).isNull()

assertThat(clientException.status.code).isEqualTo(Status.Code.INTERNAL)
Copy link
Contributor Author

@andrewparmet andrewparmet Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The status code is captured from the Exception's causal StatusException.

@jamesward jamesward merged commit 9a1d031 into grpc:master Nov 17, 2023
8 of 9 checks passed
@jamesward
Copy link
Collaborator

Good catch! Thanks for adding this.

@andrewparmet andrewparmet deleted the add-sufficient-regression-test branch November 21, 2023 04:41
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