Curriculum Errors & packaging errors.Is and errors.As
errors.Is and errors.As
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.
9 ready
01
pick one Theme 5.1 exercise 9 introduced errors.Is for matching a
02
pick oneWhen the error you want to handle is a CUSTOM TYPE (you want
03
pick onePick the IDIOMATIC Go declaration of a SENTINEL ERROR — a
04
fill blanks Type the errors package function for IDENTITY matching
05
fill blanks Type the errors package function for TYPE extraction (find
06
type one line Productive use of errors.Is across two wrap layers. The
07
type one line Productive use of errors.As. The scaffold calls
08
write a programBuild a complete program that demonstrates multiple sentinels
09
write a program Theme 5.2 capstone — errors.As extracting a stdlib typed