| Crates.io | tc-error |
| lib.rs | tc-error |
| version | 0.12.0 |
| created_at | 2021-02-21 00:58:44.741054+00 |
| updated_at | 2024-08-14 00:02:41.590902+00 |
| description | TinyChain's generic error struct |
| homepage | |
| repository | https://github.com/haydnv/tinychain.git |
| max_upload_size | |
| id | 358267 |
| size | 18,792 |
This crate is used internally by TinyChain. It provides a generic error type TCError which can be mapped to common HTTP error codes and supports serialization and deserialization with destream.
Example:
use tc_error::*;
fn expect_true(value: bool) -> TCResult<()> {
if value {
Ok(())
} else {
Err(TCError::bad_request("expected true but found", value))
}
}
assert_eq!(expect_true(true), Ok(()));
For more information on TinyChain, see: http://github.com/haydnv/tinychain