feat(ts): ts_error_handling=result — typed Result return for es-mode client - #241
Merged
Conversation
…client Adds ts_error_handling=result plugin option (requires ts_runtime=protobuf-es). Unary methods return Promise<Result<T, ClientError>> instead of throwing. ClientError is a discriminated union of ValidationError | ApiError | every proto *Error type. Structural error registry matches response JSON keys against proto Error schemas. Zero-field *Error guard prevents empty errors from shadowing. Original work from PR #210. Co-Authored-By: Hicham <53556927+hishamank@users.noreply.github.com>
🔍 CI Pipeline Status✅ Lint: success 📊 Coverage Report: Available in checks above |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #241 +/- ##
==========================================
- Coverage 28.80% 28.64% -0.16%
==========================================
Files 73 74 +1
Lines 12890 13048 +158
==========================================
+ Hits 3713 3738 +25
- Misses 8989 9119 +130
- Partials 188 191 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is @hishamank's work from #210, rebased cleanly onto main after #207 was squash-merged (which deleted the base branch and auto-closed #210).
All code authored by @hishamank — original PR: #210. Previously approved by @SebastienMelki.
Changes
ts_error_handling=resultplugin option (requirests_runtime=protobuf-es)Promise<Result<T, ClientError>>instead of throwingClientError= discriminated union ofValidationError | ApiError | <every proto *Error type>*Errorguard:keys.length > 0prevents empty errors from matching everythingTest plan
go test ./internal/tsclientgen/... ./internal/tscommon/... ./internal/urlparamtest/...all pass🤖 Generated with Claude Code