chainerror/booksrc/tutorial1.md

11 lines
351 B
Markdown
Raw Normal View History

2018-12-20 15:14:21 +01:00
## Simple String Errors
The most simplest of doing error handling in rust is by returning `String` as a `Box<Error>`.
As you can see by running the example, this only prints out the last `Error`.
If the rust `main` function returns an Err(), this Err() will be displayed with `std::fmt::Debug`.
2018-12-20 14:52:06 +01:00
~~~rust
{{#include ../examples/tutorial1.rs:2:}}
~~~