Skip to main content

renamer_rs/
error.rs

1use std::num::ParseIntError;
2use thiserror::Error;
3
4/// Errors returned by pass-it-on-command-line-client
5#[derive(Error, Debug)]
6pub enum Error {
7    /// No valid formatting patterns where detected in the format string
8    #[error("No formatting patterns were found in the format string")]
9    NoFormattingPatterns,
10
11    /// Invalid value was found during processing
12    #[error("Invalid Value: {0}")]
13    InvalidValue(String),
14
15    /// Error determining [`FormatType`][crate::FormatType] when processing found formating patterns
16    #[error("Unknown Format Type: {0}")]
17    UnknownFormatType(String),
18
19    // ### Converting from other error types ###
20    /// Pass-thru [`std::io::Error`].
21    #[error("std::io Error: {0}")]
22    StdIo(#[from] std::io::Error),
23
24    /// Pass-thru [`regex::Error`].
25    #[error("regex Error: {0}")]
26    RegEx(#[from] regex::Error),
27
28    /// Pass-thru [`ParseIntError`].
29    #[error("ParseIntError Error: {0}")]
30    ParseInt(#[from] ParseIntError),
31}