Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

feat: support custom/unknown error types#1751

Merged
sofisl merged 4 commits intomainfrom
support-unknown-error-types
May 23, 2025
Merged

feat: support custom/unknown error types#1751
sofisl merged 4 commits intomainfrom
support-unknown-error-types

Conversation

@miguelvelezsa
Copy link
Contributor

@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 a review from a team May 13, 2025 00:16
@miguelvelezsa miguelvelezsa requested a review from a team as a code owner 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
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels May 21, 2025
@miguelvelezsa miguelvelezsa force-pushed the support-unknown-error-types branch from 7625411 to 77a2d24 Compare May 21, 2025 18:58
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels May 21, 2025
@sofisl sofisl changed the title feat: support unknown error types feat: support custom/unknown error types May 23, 2025
@sofisl sofisl merged commit ddb9b5a into main May 23, 2025
27 of 28 checks passed
@sofisl sofisl deleted the support-unknown-error-types branch May 23, 2025 22:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants