Skip to content

Commit

Permalink
its: Added IssueManagementContextError::IssueNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Feb 28, 2022
1 parent 621074a commit e3c52cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions its/crates/use_case/src/use_case.rs
Expand Up @@ -29,6 +29,8 @@ pub enum IssueManagementContextError {
IssueAggregate(#[from] IssueAggregateError),
#[error("IssueBlockLinkAggregate")]
IssueBlockLinkAggregate(#[from] IssueBlockLinkAggregateError),
#[error("IssueNotFound")]
IssueNotFound(IssueId),
#[error("Unknown")]
Unknown,
}
Expand Down Expand Up @@ -145,9 +147,8 @@ pub trait IssueManagementContextUseCase: HasIssueRepository {
.issue_repository()
.find_by_id(&command.issue_id)
.await
.map_err(|_| IssueManagementContextError::Unknown)?;
// TODO: fix error
let issue = issue.ok_or(IssueManagementContextError::Unknown)?;
.map_err(|_| IssueManagementContextError::Unknown)?
.ok_or_else(|| IssueManagementContextError::IssueNotFound(command.issue_id))?;
let at = Instant::now();

// pure
Expand Down

0 comments on commit e3c52cf

Please sign in to comment.