rename ReadIssueError to just IssueError

Error handling is pretty broken in this project :-(
This commit is contained in:
Sebastian Kuzminsky 2025-07-06 00:11:23 -06:00
parent 5b1c7a52b9
commit 5e482edb5c
2 changed files with 7 additions and 7 deletions

View file

@ -25,7 +25,7 @@ pub struct Issue {
} }
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum ReadIssueError { pub enum IssueError {
#[error(transparent)] #[error(transparent)]
StdIoError(#[from] std::io::Error), StdIoError(#[from] std::io::Error),
#[error("Failed to parse issue")] #[error("Failed to parse issue")]
@ -33,7 +33,7 @@ pub enum ReadIssueError {
} }
impl FromStr for State { impl FromStr for State {
type Err = ReadIssueError; type Err = IssueError;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let s = s.to_lowercase(); let s = s.to_lowercase();
if s == "new" { if s == "new" {
@ -49,13 +49,13 @@ impl FromStr for State {
} else if s == "wontdo" { } else if s == "wontdo" {
Ok(State::WontDo) Ok(State::WontDo)
} else { } else {
Err(ReadIssueError::IssueParseError) Err(IssueError::IssueParseError)
} }
} }
} }
impl Issue { impl Issue {
pub fn new_from_dir(dir: &std::path::Path) -> Result<Self, ReadIssueError> { pub fn new_from_dir(dir: &std::path::Path) -> Result<Self, IssueError> {
let mut description: Option<String> = None; let mut description: Option<String> = None;
let mut state = State::New; // default state, if not specified in the issue let mut state = State::New; // default state, if not specified in the issue
let mut dependencies: Option<Vec<String>> = None; let mut dependencies: Option<Vec<String>> = None;
@ -84,7 +84,7 @@ impl Issue {
} }
if description == None { if description == None {
return Err(ReadIssueError::IssueParseError); return Err(IssueError::IssueParseError);
} }
Ok(Self { Ok(Self {

View file

@ -12,8 +12,8 @@ pub struct Issues {
pub enum ReadIssuesError { pub enum ReadIssuesError {
#[error(transparent)] #[error(transparent)]
StdIoError(#[from] std::io::Error), StdIoError(#[from] std::io::Error),
#[error("Failed to parse issue")] #[error(transparent)]
IssueParseError(#[from] crate::issue::ReadIssueError), IssueError(#[from] crate::issue::IssueError),
#[error("cannot handle filename")] #[error("cannot handle filename")]
FilenameError(std::ffi::OsString), FilenameError(std::ffi::OsString),
#[error(transparent)] #[error(transparent)]