Curriculum Errors & packaging errors.Is and errors.As exercise 4 · fill-word
errors.Is and errors.As
Type the errors package function for IDENTITY matching
(sentinel error in a wrap chain). Two letters, capitalised.
TypeScript reference
Fill the blanks →
About this theme
Inspecting errors without breaking the wrap chain. errors.Is(err, target) walks the wrap chain looking for a match against a sentinel. errors.As(err, &target) walks looking for a type match, populating target if found. This is the modern, type-safe replacement for instanceof checks on errors.