Skip to content

Commit

Permalink
Update www/content/tutorial.md
Browse files Browse the repository at this point in the history
Co-authored-by: Michał Kukieła <[email protected]>
Signed-off-by: Luke Boswell <[email protected]>
  • Loading branch information
lukewilliamboswell and kukimik authored Jan 8, 2025
1 parent 841287c commit c197d77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion www/content/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ Here's what this does:
- If the `Str.toU64` function returns an `Err` value, then the `try` keyword immediately interrupts the `get_letter` function and makes it return this error.
- For example, if we call `get_letter "abc"`, then the call to `Str.toU64` returns `Err InvalidNumStr`, and the `try` keyword ensures that the `get_letter` function returns this error immediately, without executing the rest of the function.

Thanks to the `try` keyword, your code can focus on the "happy path" (where nothing fails) and simply bubble up to the caller any error that might occur. Your error handling code can be neatly separated, and you can rest assured that you won't forget to handle any errors, since the compiler will let you know. See this [code example](https://github.com/roc-lang/examples/blob/main/examples/Results/main.roc) for more details on error handling.
Thanks to the `try` keyword, your code can focus on the "happy path" (where nothing fails) and simply bubble up to the caller any error that might occur. Your error handling code can be neatly separated, and you can rest assured that you won't forget to handle any errors, since the compiler will let you know. See this [code example](https://www.roc-lang.org/examples/Results/README.html) for more details on error handling.

Now let's get back to lists!

Expand Down

0 comments on commit c197d77

Please sign in to comment.