clonable errors

This commit is contained in:
Robin Appelman 2021-05-03 19:02:45 +02:00
commit ba0b66e1bb
2 changed files with 4 additions and 4 deletions

View file

@ -28,7 +28,7 @@ use thiserror::Error;
/// 6 | /// 6 |
/// ``` /// ```
/// ///
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct ParseError { pub struct ParseError {
span: Option<Span>, span: Option<Span>,
error: RawParseError, error: RawParseError,
@ -148,7 +148,7 @@ fn get_position(text: &str, index: usize) -> Position {
pos pos
} }
#[derive(Error, Debug)] #[derive(Error, Debug, Clone)]
pub enum RawParseError { pub enum RawParseError {
#[error("{0}")] #[error("{0}")]
UnexpectedToken(#[from] UnexpectedTokenError), UnexpectedToken(#[from] UnexpectedTokenError),
@ -183,7 +183,7 @@ impl From<UnescapeError> for RawParseError {
} }
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct UnexpectedTokenError { pub struct UnexpectedTokenError {
pub expected: Vec<Token>, pub expected: Vec<Token>,
pub found: Option<Token>, pub found: Option<Token>,

View file

@ -1,6 +1,6 @@
use thiserror::Error; use thiserror::Error;
#[derive(Debug, Error)] #[derive(Debug, Error, Clone)]
pub enum ParseIntError { pub enum ParseIntError {
#[error("cannot parse integer from empty string")] #[error("cannot parse integer from empty string")]
Empty, Empty,