Skip to main content

rfham_markdown/
error.rs

1//!
2//! Provides this crate's [`Error`] and [`Result`] types.
3//!
4
5use std::string::FromUtf8Error;
6use thiserror::Error;
7
8// ------------------------------------------------------------------------------------------------
9// Public Types
10// ------------------------------------------------------------------------------------------------
11
12///
13/// The `Error` type for this crate.
14///
15#[derive(Debug, Error)]
16pub enum MarkdownError {
17    #[error("I/O error: {0}")]
18    Io(#[from] std::io::Error),
19
20    #[error("Unable to convert from UTF-8 to string; error: {0}")]
21    FromUtf(#[from] FromUtf8Error),
22}
23
24///
25/// A `Result` type that specifically uses this crate's `Error`.
26///
27pub type MarkdownResult<T> = std::result::Result<T, MarkdownError>;