dphfox / Fusion

A modern reactive UI library, built specifically for Roblox and Luau.
https://elttob.uk/Fusion/
MIT License
585 stars 102 forks source link

Write tutorial for `Safe` expressions #328

Closed dphfox closed 5 months ago

dphfox commented 5 months ago

https://elttob.uk/Fusion/0.3/api-reference/general/members/safe/

Safe expressions can be used to guard against errors while passing return values through, allowing for easier inline dealing with errors.

[Children] = Safe {
    try = function()
        return scope:FallibleComponent {
            ThrowError = "You didn't do the right thing :("
        }
    end,
    fallback = function(err)
        return scope:ErrorMessage {
            Text = `Something went wrong: {err}`
        }
    end
}

They should be documented as part of the Best Practices tutorial section, so that users can understand their purpose and usage.