doc_chunks/
errors.rs

1use crate::{Range, Span};
2use indexmap::IndexMap;
3
4pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(thiserror::Error, Debug)]
7pub enum Error {
8    #[error(transparent)]
9    Io(#[from] std::io::Error),
10
11    #[error("Really pretty much anything")]
12    Any,
13
14    #[error("Failed to parse rust content: {0:?}")]
15    ParserFailure(#[source] syn::Error),
16
17    #[error("Failed to parse toml file")]
18    Toml(#[from] toml::de::Error),
19
20    #[error("{0}")]
21    Span(String),
22
23    #[error("BUG: Found a range {}..{} which that does not exist in its own source mapping: {:?}", .line_range.start, .line_range.end, .source_mapping)]
24    InvalidLineRange {
25        line_range: Range,
26        source_mapping: IndexMap<Range, Span>,
27    },
28}