unthrown icon indicating copy to clipboard operation
unthrown copied to clipboard

fix(orpc): qualify handler throws before eliminating Result outcomes

Open btravers opened this issue 1 month ago • 0 comments

Problem

handlerResult invokes await handler(opts, input) before its Result guards. A handler throwing ORPCError("NOT_FOUND", { message: "private handler detail" }) when NOT_FOUND is declared becomes a modeled Err and exposes that message. Reproduced with createRouterClient and createResultClient. A returned Defect carrying the same error is wrapped correctly, so direct throws currently skip that protection.

Locations

packages/orpc/src/server.ts: handlerResult

Acceptance

Qualify synchronous throws and asynchronous rejections from handler invocation before eliminating the Result. Preserve intentionally returned Err refusals. Add real oRPC regressions for thrown and rejected declared ORPCError causes and returned Defects.

Found in the deep audit of accounting, btravstack 0.29.0 and unthrown 5.12.0.

btravers avatar Oct 11 '26 23:10 btravers