completed 05 ticket v2, started 06 tms
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user