Exceptions

This demo shows how exceptions are handled.

Issue for implementing error boundaries

Count: 0

Show source
:ruby Button = import("/app/components/Form/Button") Heading = import("/app/components/Layout/Heading") Highlight = import("/app/components/UI/Highlight") Card = import("/app/components/UI/Card") Details = import("/app/components/UI/Details") Link = import("/app/components/UI/Link") def self.get_initial_state(**) = { count: 0 } def handle_click(e) = case e in { target: { name: "increment" } } update do |state| { count: state[:count] + 1 } end end %article %Heading(level=2) Exceptions %p This demo shows how exceptions are handled. %p %Link(href="https://github.com/mayu-live/framework/issues/6") Issue for implementing error boundaries %p Count: %output<= state[:count] .buttons %Button(onclick=handle_click name="increment") Increment %Button(onclick=handle_click name="error") Error %Details(summary="Show source") %Highlight(language="haml") = File.read("app/pages/demos/exceptions/page.haml") :css .buttons { display: flex; gap: 1em; margin: 1em 0; }