rsexpr/error.rs
1use thiserror::Error;
2
3use crate::ParenKind;
4
5/// The default result type. The error variant is a vector of [`Error`](enum@Error)s
6pub type Result<T> = std::result::Result<T, Vec<Error>>;
7
8/// The crate error type.
9#[derive(Debug, Error, PartialEq, Eq)]
10pub enum Error {
11 /// The input is missing a closing parenthesis
12 #[error("missing closing parenthesis `{0}`")]
13 MissingClosingParen(ParenKind),
14
15 /// The input has an unexpected extra closing parenthesis
16 #[error("extra closing parenthesis `{0}`")]
17 ExtraClosingParen(ParenKind),
18
19 /// The input contains no S-expression
20 #[error("input contains no S-expression")]
21 EmptyInput,
22
23 /// The input contains more than one S-expression
24 #[error("input contains more than one S-expression")]
25 ExtraSexprs,
26}