Repository navigation
fix(saver): propagate save failures to callers - #3033
Conversation
neSpecc
left a comment
There was a problem hiding this comment.
Thanks, the fix is right: Saver.save() now rethrows, so await editor.save() rejects with the original error instead of resolving to undefined.
A few things before merge:
-
readOnly.toggle(true)sets the read-only flag before callingSaver.save()(readonly.ts, ~70-115). If saving fails, the editor stays flagged as read-only while blocks are still editable, and latereditor.save()calls fail with "can not be saved in read-only mode". Now that the error is propagated, please set the flag only after a successful save (or roll it back on error) and add a test for it. -
Please add a CHANGELOG entry under
2.32.0and rebase onto currentnext.2.32.0-rc.5is already taken by #3048, so either bump torc.6or leave the bump to the Bump version job.
Summary
Saver.save()currently logs caught errors without rethrowing them,allowing a failed save to resolve with
undefined.Rethrow the original error after logging so callers can handle the rejection.
Normal invalid-block filtering and the existing Tune error-handling behavior
remain unchanged.
Add regression coverage for synchronous
Tool.save()throws, asynchronousrejections, invalid-block filtering, and the existing rejection when saving
in read-only mode.
Fixes #3030.
Verification
Local validation of the reviewed candidate:
4 passing / 2 expected failures because save resolved with
undefined.multi-block data preservation, validation rejection, existing Tune behavior,
and awaited read-only transitions.
Existing warnings were retained.
Full Cypress, Firefox, Edge, and a standalone TypeScript check were not run.
The separate review probes are validation evidence and are not included
in this PR.
This change does not implement automatic rollback of the read-only state
after a failed transition.
Implementation and local verification were AI-assisted.