[codex] structure Electron theme source errors - #3294
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 This PR adds structured error handling for the Electron theme source setting operation. The core behavior is unchanged - it only improves how errors are captured and typed. The changes are self-contained with good test coverage. You can customize Macroscope's approvability policy. Learn more. |
Summary
Verification
vp test apps/desktop/src/electron/ElectronTheme.test.tsvp check(0 errors; 20 existing warnings)vp run typecheckNote
Low Risk
Small, localized Electron theme wrapper change;
setThemeIPC may now surface failures that previously could throw uncaught, but scope is non-critical UI theming.Overview
ElectronTheme.setSourceno longer assumes nativethemeSourceassignment always succeeds. It now runs the Electron setter insideEffect.tryand fails with a schema-backedElectronThemeSetSourceErrorthat carries the requestedDesktopTheme(source) and the underlying defect (cause), plus a stable user-facing message that names the source but not the raw cause.The service type and a
Schema.isguard are exported so callers (e.g. IPCsetTheme) can narrow failures. Tests extend the Electron mock to throw on set and assert error shape, source, cause, and message content.Reviewed by Cursor Bugbot for commit c1ea123. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure Electron theme source errors into a typed
ElectronThemeSetSourceErrorElectronThemeSetSourceError, aSchema.TaggedErrorClasscarrying the requestedsourceand originalcause, replacing raw thrown errors fromnativeTheme.themeSourceassignment.ElectronTheme.setSourcereturn type fromEffect<void>toEffect<void, ElectronThemeSetSourceError>, making failures explicit to callers.isElectronThemeSetSourceErrortype guard for consumers to narrow the error type.Macroscope summarized c1ea123.