Improve Rust prelude error messages
- Dominant language
- Rust
- Stars
- 188
- Forks
- 41
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 12
Description
When calling the prelude with wrong arguments, instead of panicking without error message, an error message could describe the problem. For example when calling `led::set()` with an out-of-bound index.
Ideas:
- Trapping should be reserved for undefined behaviors (e.g. invalid pointers). The platform should return errors for everything else (index out of bound, no permission, etc).
- Prelude functions should propagate the error when the user could not have prevented it (e.g. a function is not implemented and doesn't provided an `is_supported` function).
- Prelude functions should panic on errors that the user could have prevented (e.g. out of bound index).
- All those behaviors (trap, panic, error) should be documented on the prelude functions in the appropriate section.
Sub-tasks:
- #463
- #464
Contributor guide
Assessment
This issue has not been assessed yet.