As errors can be wrapped in recent versions of Go, the proper way to check the error types are `errors.As` and `errors.Is`.