feat: add error codes and diagnostic context to error display#19
feat: add error codes and diagnostic context to error display#19PastaPastaPasta merged 6 commits intomainfrom
Conversation
Add ERR-1001 through ERR-1012 error codes mapping to specific failure categories (key gen, tx build, broadcast, islock, registration, topup, etc). The error screen now shows the error code, a human-readable label, which step failed, the raw error message, and a copy-details button for easy issue reporting.
…apping Move step-to-error-code mapping into state.ts (StepErrorCodes) so setError auto-derives the code from the current step. Extract toError() helper to eliminate repeated instanceof checks across 6 catch blocks. Replace hardcoded 'ERR-1000' fallback with ErrorCodes.UNKNOWN constant.
…oting The Copy Error Details button now copies a full JSON diagnostic payload including txid, deposit address, UTXO, identity IDs, DPNS state, stack trace, and all relevant context. A collapsible Technical Details section shows key fields inline. This lets devs identify the exact failure case from a user-provided error report.
Derive techLines from the diag object instead of re-reading state fields. Extract errorCode to avoid duplicate fallback computation in buildErrorDiagnostics. Replace 'as string' type assertions with String() coercion.
…ntext signedTxHex is a signed unbroadcast transaction — if copied into a bug report before broadcast, anyone can steal the funds. Removed from diagnostics; txid + UTXO is sufficient for on-chain lookup. Also added dpnsResults and dpnsRegistrationProgress to diagnostics for debugging partial DPNS registration failures.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe pull request introduces a comprehensive error handling enhancement system across the bridge application. Changes include new error code categorization and labels, improved error state tracking with error step recording, enhanced error UI with collapsible technical diagnostics, and updated catch handlers to normalize errors and propagate error codes throughout the application flow. Changes
Sequence DiagramsequenceDiagram
participant Main as Event Handler
participant State as Error State Manager
participant UI as UI Renderer
participant Diagnostics as Diagnostics Builder
Main->>Main: catch(error)
Main->>Main: toError(error)<br/>(normalize to Error)
Main->>State: setError(state, error, errorCode?)
State->>State: Derive errorCode from<br/>StepErrorCodes or fallback
State->>State: Record errorStep from<br/>current state.step
State-->>Main: Return updated state<br/>with error metadata
Main->>UI: Trigger state update
UI->>Diagnostics: buildErrorDiagnostics(state)
Diagnostics->>Diagnostics: Construct diagnostic payload<br/>(code, label, stack,<br/>context, timestamp)
Diagnostics-->>UI: Return diagnostics object
UI->>UI: renderErrorStep(state)<br/>Display error code, label,<br/>failed step, collapsible details
UI->>UI: Render "Copy Error Details"<br/>button with clipboard action
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes