Surface sanitized underlying error detail in typed ExecuteAction failures - #62
Conversation
…teAction failures Typed ExecuteAction handlers wrapped any thrown venue/ccxt error in an opaque gRPC status (e.g. INTERNAL "Order Creation failed"); the real error class and message only reached the in-enclave log. Callers could not tell an InsufficientFunds from a BadSymbol, which led to a createOrder failure being misdiagnosed as an unsupported pair. Add sanitizeErrorDetail/errorClassName in helpers/shared/errors: a single-line, 512-char-capped "<Class>: <message>" detail built from the caught error. Append it to the existing failure message in every typed handler (orders, perp-config, withdraw, internal-transfer, order-book-call) while keeping the existing gRPC status code and message prefix so downstream text/code matching still works. For the stable-prefix handlers (deposit, treasury-call) the class name is appended as a suffix via rejectWithGrpcError, after code derivation, so stableGrpcErrorCode matching on the raw message is preserved. In-enclave safeLogError logging is unchanged; the pass-through Call handler already surfaced detail and is untouched.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
Typed ExecuteAction handlers previously wrapped any thrown exception as an opaque generic status (e.g.
INTERNAL "Order Creation failed"), with the underlying ccxt/venue error visible only in the in-enclave logs. In production this converted a transientcreateOrderrejection into a multi-day misdiagnosis ("pair unsupported") because callers had no error detail to go on — while the pass-throughCallpath already surfaces raw ccxt messages, so exposing them has established precedent.sanitizeErrorDetail/errorClassNamehelpers insrc/helpers/shared/errors.ts:"<ClassName>: <message>", whitespace collapsed to single spaces, capped at 512 chars. The ccxt class name (InsufficientFunds,OrderNotFound,InvalidOrder, …) is the high-value signal.Order Creation failed: InsufficientFunds: binance Account has insufficient balance…). All gRPC status codes and message prefixes are preserved, so existing consumer matching is unaffected.deposit.ts/treasury-call.tsroute throughrejectWithGrpcError, which derives the code from the raw message prefix — for those, the class name is appended as a suffix via a new opt-inappendClassNameoption so code derivation is undisturbed.safeLogErrorlogging unchanged.Testing
bun test: 405 → 413 passed, 0 failed (new: helper unit tests; handler tests asserting code preserved + prefix preserved + class/message appended + single-line + 512-char cap). One existing telemetry test that asserted the old opaque message was updated to the enriched contract.bunx biome check: no new issues (one pre-existing import-ordering error cleared). Husky pre-commit (format + full suite) passed.