refactor: migrate the examples to fallible view and init - #141
Merged
Merged
Conversation
meszmate
force-pushed
the
refactor/fallible-example-views
branch
from
August 14, 2026 03:40
1359fc5 to
cf777cb
Compare
meszmate
force-pushed
the
feat/fallible-model-callbacks
branch
from
August 14, 2026 04:37
1fb58a9 to
7d94d85
Compare
418 of the 521 `catch` sites in examples/ are gone -- every one of them
a rendering fallback that turned an allocation failure into output the
user cannot distinguish from real content: a "?" where a number belongs,
a title that silently loses its styling, a whole frame replaced by the
word "Error".
Every `view` that had such a fallback now returns `![]const u8`, and
`init` bodies that dropped registrations on the floor
(`table.addRow(...) catch {}`, `help.addBinding(...) catch {}`) now
propagate.
What is left is deliberate: `catch return .none` in update, the file
open failures in file_browser, `catch unreachable` where the call
genuinely cannot fail. Those are error handling, not fallbacks.
meszmate
force-pushed
the
refactor/fallible-example-views
branch
from
August 14, 2026 04:44
cf777cb to
2c399c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 3 from the review.
418 of the 521
catchsites inexamples/are gone. Every one of them was a rendering fallback that turned an allocation failure into output a user cannot tell apart from real content — a"?"where a number belongs, a title that silently loses its styling, a whole frame replaced by the word"Error".Every
viewthat had such a fallback now returns![]const u8.initbodies that dropped registrations on the floor were migrated too —showcase.zigalone had 28 of these:A row that fails to be added is a bug, not a display variation.
What was deliberately left alone
catch return .noneinupdate, the file-open failures infile_browser,catch unreachablewhere a call genuinely cannot fail. Those are error handling, not fallbacks — 103 sites, and they stay.How it was done, and how it was checked
Mechanically, then reviewed. The transform only touched
catch <value>andcatch {}, nevercatch return/catch continue/catch |err|. Verified afterwards that:catch (return|break|continue|\|)— no control flow was rewrittentrylanded inside a string literal or a comment (three comments that a regex pass did mangle were repaired)try try, notryin a syntactically odd positionzig build,zig build test, andzig build test -Doptimize=ReleaseSafeare all clean42 files, 566 insertions, 566 deletions — every changed line is one of the two shapes above.