completed 05 ticket v2, started 06 tms
Some checks failed
CI / build (push) Failing after 1m54s
CI / gravity (push) Has been skipped
CI / is_fresh (push) Successful in 31s
CI / formatter (push) Failing after 7m2s

This commit is contained in:
2025-03-17 12:14:28 +05:30
parent 8413518a84
commit 2fa61e7715
9 changed files with 126 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
use status::ParseStatusError;
use crate::status::Status;
// We've seen how to declare modules in one of the earliest exercises, but
@@ -23,6 +25,8 @@ pub enum TicketNewError {
DescriptionCannotBeEmpty,
#[error("Description cannot be longer than 500 bytes")]
DescriptionTooLong,
#[error("{0}")]
InvalidStatus(#[from] ParseStatusError),
}
#[derive(Debug, PartialEq, Clone)]
@@ -46,8 +50,7 @@ impl Ticket {
if description.len() > 500 {
return Err(TicketNewError::DescriptionTooLong);
}
// TODO: Parse the status string into a `Status` enum.
let status = Status::try_from(status)?;
Ok(Ticket {
title,