Skip to content

Commit

Permalink
fix: add error details for INTERNAL error (#2413)
Browse files Browse the repository at this point in the history
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/java-spanner/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the [samples format](
https://togithub.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
  • Loading branch information
gyang-google committed May 5, 2023
1 parent afcc598 commit ed62aa6
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -428,7 +428,8 @@ protected Status toStatus(SpannerException e) {
case CANCELLED:
return Status.fromCode(Status.CANCELLED.getCode()).withDescription(e.getMessage());
case INTERNAL:
return Status.fromCode(Status.INTERNAL.getCode()).withDescription(e.getMessage());
return Status.fromCode(Status.INTERNAL.getCode())
.withDescription(e.getMessage() + e.getReason() == null ? "" : ": " + e.getReason());
case FAILED_PRECONDITION:
return Status.fromCode(Status.FAILED_PRECONDITION.getCode())
.withDescription(e.getMessage());
Expand Down

0 comments on commit ed62aa6

Please sign in to comment.