fix(sdk-core): return clear 401 for wrong wallet passphrase#9365
fix(sdk-core): return clear 401 for wrong wallet passphrase#9365shubham-damkondwar wants to merge 1 commit into
Conversation
Preserve signing error details instead of wrapping them into generic Internal Server Error responses. Ticket: COINS-1257
|
Claude finished @shubham-damkondwar's task —— View job Code Review for PR #9365This PR effectively addresses incorrect wallet passphrase error handling by returning proper 401 HTTP responses with clear error codes instead of generic 500 errors. The changes are well-structured and focused. Key Improvements✅ Proper Error Classification
✅ Enhanced Express Error Handling
✅ TSS Signing Improvements
✅ RetryPromise Fix
✅ Comprehensive Test Updates
Technical QualityCode Pattern Consistency: The implementation follows a clear pattern of distinguishing between system errors (malformed data) and user errors (wrong credentials). Error Message Clarity: The regex pattern Backwards Compatibility: Changes preserve existing error handling for non-passphrase related failures while improving user experience for authentication errors. Minor Considerations
Overall, this is a well-implemented improvement that enhances error handling precision and user experience. The changes are focused, well-tested, and maintain backward compatibility while providing clearer feedback to API consumers. Recommendation: ✅ Approve - This PR effectively addresses the stated objectives with clean, maintainable code and comprehensive test coverage. PR #9365 | Branch: COINS-1257 |
Summary
IncorrectPasswordError(HTTP 401,wallet_passphrase_incorrect) for wrong wallet passphrase instead of a generic 500 / Internal Server ErrorretryPromiseanddecryptPrivKeyto keep actionable passphrase vs malformed-ciphertext errorsTicket: COINS-1257
Note: Separate from BitGo Internal Agent PR #9344 (ICP broadcast certificate parsing), which addresses a different failure mode than this ticket’s remaining ask.
Test plan
coinSign,generateShareTSS,ofcExtSignPayload)retryPromisepreserves original error without wrappingsignPayloadpassphrase vs malformed ciphertext casesPOST /api/v2/icp/wallet/:id/signtxtsswith wrongwalletPassphrasereturns 401 +code: wallet_passphrase_incorrect