typeover
rust curriculum

Curriculum Errors, crates & tests Custom error enums exercise 1 · mcq

Custom error enums

A small CLI parses numbers and divides them. Pick the idiomatic Rust DOMAIN error type that names each failure mode explicitly.

TypeScript reference
Pick the idiomatic Go translation

About this theme

Small Rust programs often use an enum for domain errors. This theme teaches error variants, carrying context, Display, and using From so ? can convert lower-level errors. Planned exercises: 1. choose an error enum. 2. recognise context-carrying variants. 3. choose From for conversion. 4. fill an Err(MyError::...). 5. fill a Display arm. 6. write a domain error enum. 7. write a conversion with From. 8. translate TS custom error classes. 9. fix an error propagation type mismatch.