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

View file

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