Curriculum Errors Error sets
Error sets
An error set is a finite enumeration of named errors — declared as error{ Empty, BadDigit, ... }. Different APIs declare their own sets; the compiler tracks which errors a function can return as part of the type. error{} is the bottom set (no errors); the inferred set anyerror is the top (matches anything). A function returning ErrSet!T means: either T (success) or one of ErrSet's variants (failure). Composition is via the || operator — ErrA || ErrB makes a set covering both.
9 ready
01
pick oneTypeScript reaches for a class hierarchy (`class NotFoundError
02
pick oneOnce you've declared an error set, you raise a value from it
03
pick one Two error sets can be COMBINED with the || operator — the
04
fill blanksFill the missing keyword that introduces an error-set type
05
fill blanksFill the missing prefix used at a RAISE site to refer to an
06
type one line Type the missing Zig line — declare the ParseError set with
07
type one line Type the missing Zig line — return error.Empty when the
08
write a programWrite a complete Zig program that defines `LookupError =
09
write a programWrite a complete Zig program that composes TWO error sets: