exercism/elixir/rpn-calculator/HINTS.md

23 lines
687 B
Markdown
Raw Normal View History

2024-03-07 06:40:53 +00:00
# Hints
## General
- Read about [errors][errors] in the Getting Started guide.
- Read about [`try`][docs-try] in the documentation.
## 1. Warn the team
- Allow the operation function to raise its error.
- To invoke a function in a variable, use the `.` operator.
## 2. Wrap the error
- Make use of try .. rescue to return the intended result.
## 3. Pass on the message
- Make use of try .. rescue to return the intended result.
- The rescue block allows you to pattern match on the error's Module name and also bind the error to a variable.
[errors]: https://hexdocs.pm/elixir/try-catch-and-rescue.html#errors
[docs-try]: https://hexdocs.pm/elixir/Kernel.SpecialForms.html#try/1