[codex] Structure empty mobile pairing payload errors#3372
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved Straightforward error refactor that replaces a plain Error with a structured typed error class. No runtime behavior change - same error message thrown in the same condition, just with better type discrimination for callers. You can customize Macroscope's approvability policy. Learn more. |
Summary
Errorwith a distinct Schema-tagged errorValidation
pnpm vp test apps/mobile/src/features/connection/pairing.test.tspnpm vp check(20 pre-existing warnings)pnpm vp run typecheckpnpm vp run lint:mobileNo active open PR modifies these files.
Note
Low Risk
Localized pairing validation change with no auth or data-path impact; UI still relies on the same error message.
Overview
Empty or whitespace-only QR scan input in
extractPairingUrlFromQrPayloadnow throwsPairingQrPayloadEmptyError, aeffect/SchemaTaggedErrorClass, instead of a genericError. The user-facing message is unchanged.Tests assert both the error type and the same message string. Call sites that read
error.message(e.g. the new-connection QR handler) keep the same behavior.Reviewed by Cursor Bugbot for commit f96c917. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Replace generic
ErrorwithPairingQrPayloadEmptyErrorinextractPairingUrlFromQrPayloadIntroduces
PairingQrPayloadEmptyError, a tagged error class (viaeffect/Schema) in pairing.ts, replacing the genericErrorthrown when an empty or whitespace-only QR payload is detected. The error message is unchanged. Tests in pairing.test.ts are updated to assert the specific error class is thrown.Macroscope summarized f96c917.