Skip to content

feat: support unknown error types #1751

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

miguelvelezsa
Copy link

@miguelvelezsa miguelvelezsa commented May 13, 2025

Description

Currently when decoding HTTP error, if the server returns an error that is not an rpc.StatusDetails, it will thrown an error about it instead of returning the real error. This is because it can't find the proto, the decoder is only using the error details loaded from status.json in https://github.com/googleapis/gax-nodejs/blob/main/gax/src/googleError.ts#L175). This PR will fix that.

Impact

Instead of throwing an error about the custom/unknown proto for the error, we are a going to convert it to a ResourceInfo error and put in the description the details from the custom/unknown error.

Testing

Added unit test for custom/unknown errors in this PR.

Additional Information

Any additional details that we should be aware of?

It seems RPC catch these kind of errors on https://github.com/googleapis/gax-nodejs/blob/main/gax/src/googleError.ts#L213, it is just ignoring but we need to show the info of the custom error. There is an internal bug about it, will work on that later.

Checklist

  • [ Done] Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • [ Done] Ensure the tests and linter pass
  • [ Done] Code coverage does not decrease
  • Appropriate docs were updated
  • [ Done] Appropriate comments were added, particularly in complex areas or places that require background
  • No new warnings or issues will be generated from this change

Fixes #issue_number_goes_here 🦕 (no added, not sure if we can publish internal bugs here).

@miguelvelezsa miguelvelezsa requested review from a team as code owners May 13, 2025 00:16
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label May 13, 2025
@miguelvelezsa miguelvelezsa force-pushed the support-unknown-error-types branch from b67d71b to 1b5c12b Compare May 13, 2025 00:54
@miguelvelezsa miguelvelezsa force-pushed the support-unknown-error-types branch from 2c9b379 to 77a2d24 Compare May 14, 2025 22:57
@miguelvelezsa miguelvelezsa changed the title Support unknown error types feakSupport unknown error types May 14, 2025
@miguelvelezsa miguelvelezsa changed the title feakSupport unknown error types feat: support unknown error types May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants