handle user abort in ent comment
The user saving an empty description is a normal user-initiated abort, not an error.
This commit is contained in:
parent
a199fbc7f7
commit
acf539c683
1 changed files with 13 additions and 5 deletions
|
|
@ -234,12 +234,20 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
|
||||||
return Err(anyhow::anyhow!("issue {} not found", issue_id));
|
return Err(anyhow::anyhow!("issue {} not found", issue_id));
|
||||||
};
|
};
|
||||||
let mut comment = issue.new_comment()?;
|
let mut comment = issue.new_comment()?;
|
||||||
match description {
|
let r = match description {
|
||||||
Some(description) => {
|
Some(description) => comment.set_description(description),
|
||||||
comment.set_description(description)?;
|
None => comment.edit_description(),
|
||||||
|
};
|
||||||
|
match r {
|
||||||
|
Err(entomologist::comment::CommentError::EmptyDescription) => {
|
||||||
|
println!("aborted new comment");
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
None => {
|
Err(e) => {
|
||||||
comment.edit_description()?;
|
return Err(e.into());
|
||||||
|
}
|
||||||
|
Ok(()) => {
|
||||||
|
println!("created new comment {}", &comment.uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue