Skip to content

Update from_into exercise to use error handling instead of default value#2297

Closed
iaadi4 wants to merge 1 commit intorust-lang:mainfrom
iaadi4:from_into-error-handling
Closed

Update from_into exercise to use error handling instead of default value#2297
iaadi4 wants to merge 1 commit intorust-lang:mainfrom
iaadi4:from_into-error-handling

Conversation

@iaadi4
Copy link
Copy Markdown

@iaadi4 iaadi4 commented Oct 2, 2025

closes #2225

…lues

- Replace From<&str> trait with TryFrom<&str> for proper error handling
- Add ParsePersonError enum with BadLen, NoName, and ParseInt variants
- Update all tests to expect appropriate errors instead of default Person values
- Maintain same error handling pattern as from_str exercise
- Add required imports for TryFrom and TryInto traits
@senekor
Copy link
Copy Markdown
Contributor

senekor commented May 3, 2026

This is completely misguided. There is a separate exercise to teach the TryFrom trait.

@senekor senekor closed this May 11, 2026
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

Successfully merging this pull request may close these issues.

Incorrect answer passed in from_into.rs

2 participants