Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(01) Ticket - Validation #36

Open
ghost opened this issue Nov 11, 2021 · 1 comment
Open

(01) Ticket - Validation #36

ghost opened this issue Nov 11, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 11, 2021

hello,

Im now looking at this part

/// So far we have allowed any string as a valid title and description.
/// That's not what would happen in JIRA: we wouldn't allow tickets with an empty title,
/// for example.
/// Both title and description would also have length limitations: the Divine Comedy probably
/// shouldn't be allowed as a ticket description.
///
/// We want to define a function that takes in a title, a description and a status and
/// performs validation: it panics if validation fails, it returns a `Ticket` if validation
/// succeeds.
///
/// We will learn a better way to handle recoverable errors such as this one further along,
/// but let's rely on panic for the time being.
fn create_ticket(title: String, description: String, status: Status) -> Ticket {
                                                                             todo!()
                                                                                    }
                                                                                    ````

What am I suppose to do ?

and how do I know what a valid title and description is ?
@Zyhael
Copy link

Zyhael commented Aug 1, 2024

If you look at the end or bottom part of the source file, you will find what a valid title or description is.
You will have to replace the todo!() function with if statements that panic! when the title/description is invalid.
More information on panics:
https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant