Preserve typed handler error category through dispatch (#83) #86
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_rpc!86
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-83-error-categories"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #83. RpcErrorKind + new RpcError variants (Invalid/NotFound/PermissionDenied) so typed category survives. Generator emits category() on service-error enums + tagged glue. Dispatch maps Invalid → -32602, NotFound → -32602, PermissionDenied → -32000, Internal/Operation → -32603. Fixes the misleading 'Redis operation error:' prefix on non-Redis failures. 77 lib tests + 6 recipe_server tests pass; integration tests cover validation → -32602 round trip.
* Unit tests in `crates/osis/src/rpc/error.rs` for `RpcError::kind()` and the renamed `Operation` Display (no more `Redis operation error:`). * Unit tests in `crates/osis/src/rpc/dispatch.rs` for the `RpcErrorKind` → JSON-RPC code mapping (Invalid → -32602, PermissionDenied → -32000, Internal → -32603). * Integration tests in `example/recipe_server/.../recipes/tests.rs` driving `OsisRecipes::handle_service_call` and asserting: - missing parameter → `RpcError::Invalid` - handler returning `RecipeServiceError::NotFound` → `RpcError::NotFound` - unknown method body still carries the `Unknown method:` marker that dispatch.rs uses to route to `method_not_found`. These pin the acceptance criteria from the issue: validation errors surface as -32602 with a clean message (no `Redis operation error:` prefix), real internal faults still surface as -32603.