lib/errors: add interfaces for typed errors
Created by: bobheadxi
Introducing custom error types can be tricky - I realized there's no code-level assertions or docs on Is
and As
implementations, so this PR introduces some interfaces to guide implementers. We write them ourselves because the standard library does not provide them, and it allows us to include docstrings better.
Test plan
compiles