simple-error
simple-error
is a Rust
library that provides a simple Error
type backed by a String
. It is best used when all you care about the error is an error string.
Usage
To use simple-error
, first add this to your Cargo.toml
:
[]
= "0.1"
Then add this to your crate root:
extern crate simple_error;
Now you can use simple-error
in different ways:
You can use it simply as a string error type:
You can use it to replace all error types if you only care about a string description:
Or you can chain all the errors, and get a complete error description at the top level:
// This prints out "cannot watch tv, tv remote not found, failed to open remote file, Text file busy" if the error is text file busy.