public_api/error.rs
1use thiserror::Error;
2
3#[derive(Error, Debug)]
4#[non_exhaustive]
5/// Enumerates all errors that can currently occur within this crate.
6pub enum Error {
7 /// Occurs if the rustdoc JSON you provide can't be parsed. Typically
8 /// because the rustdoc JSON format that your version of nightly outputs is
9 /// too old. Consult the "Compatibility matrix" in the README.
10 #[error(transparent)]
11 SerdeJsonError(#[from] serde_json::Error),
12
13 /// Some kind of IO error occurred. For example, we might not have read
14 /// permissions on the rustdoc JSON input file.
15 #[error(transparent)]
16 IoError(#[from] std::io::Error),
17}
18
19/// Shorthand for [`std::result::Result<T, public_api::Error>`].
20pub type Result<T> = std::result::Result<T, Error>;