Skip to content

docstore: Support unwrapping action list errors#3705

Merged
vangent merged 2 commits intogoogle:masterfrom
Megakuul:master
Apr 20, 2026
Merged

docstore: Support unwrapping action list errors#3705
vangent merged 2 commits intogoogle:masterfrom
Megakuul:master

Conversation

@Megakuul
Copy link
Copy Markdown
Contributor

Example changes to use struct error types (see #3702 ).

While creating this PR I realized that there is already a concrete infrastructure for unwrapping driver specific errors (e.g. docstore.ErrorAs()). Besides, I also realized that rewriting this part is currently not very simple because it would inflict breaking changes in the driver<->interface API.

Therefore, I as initial step I added a new Wrap() function which simply wraps a gcerrs.Error into a code-specific struct (currently only implemented AlreadyExistsError).

The idea behind such an approach would be to slowly migrate to struct errors like this:

  1. Slowly deprecate gcerror.ErrorAs() as it would now be possible to extract driver specific errors by simply using errors.As().
  2. Instead of wrapping error codes, change the driver API to convert driver-errors to struct error wrappers (this step would break the API between driver<->sdk interface).
  3. Remove legacy error helpers and deprecate error codes.

As already explained, I do now see that this is a long, complex and especially breaking process, therefore it is up to you to decide if the effort is worth going this way.

@vangent
Copy link
Copy Markdown
Contributor

vangent commented Apr 19, 2026

PTAL #3708 and see what you think. I think this solves the problem of being able to use errors.Is, taking advantage of the fact that Go CDK errors are already wrapped.

Comment thread gcerrors/errors.go Outdated
Comment thread docstore/docstore.go Outdated
Comment thread docstore/docstore.go Outdated
Comment thread docstore/docstore.go Outdated
@vangent
Copy link
Copy Markdown
Contributor

vangent commented Apr 19, 2026

Please also update the PR title to reflect this is just about docstore's ActionList.

@Megakuul Megakuul changed the title gcerrors: Support unwrapping error types (example for #3702) docstore: Support unwrapping action list errors Apr 20, 2026
@Megakuul Megakuul requested a review from vangent April 20, 2026 15:27
@vangent vangent merged commit 45a8cfc into google:master Apr 20, 2026
5 checks passed
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