book icon indicating copy to clipboard operation
book copied to clipboard

Adding a small explanations on hardware exceptions vs software exceptions

Open Dajamante opened this issue 3 years ago • 0 comments

In the book there is a paragraph on hardware exceptions: https://docs.rust-embedded.org/book/start/exceptions.html?highlight=exception#the-default-exception-handler This can be a question mark for people used to software exceptions.

What about adding, directly after the first paragraph:

Hardware exceptions are different from exceptions thrown in software, which are a way of handling errors for both recoverable and unrecoverable errors. For recoverable error handling, Rust uses the Result type Result<T, E>, where T is the Ok value type, and E is a specific, configurable error. For unrecoverable software error handling, Rust uses panic that stops execution. This is closer to exceptions thrown in software using other languages.

If you think it can be a useful addition I can make a PR.

Dajamante avatar Mar 07 '22 09:03 Dajamante