@cblgh no rush on this. I have gone back and forth on this and I think it's ready for another pair of eyeballs. What do you think of the error checking API in examples/errors/errors.go?
Internals nerd zone
Sadly, iroh will not give us the `IrohError` directly from the API. That is what we want because it gives us the detailed error message in `IrohError.Message()`. So, we need to kind of wrap up some sort of convenient conversion and also preserve the `err != nil` checks that you usually expect. It's too verbose to have to do this every time we receive an `error` on the API consumer side. That's the `iroh.As` API. `errors.Is` is supported in general now.
@cblgh no rush on this. I have gone back and forth on this and I think it's ready for another pair of eyeballs. What do you think of the error checking API in [`examples/errors/errors.go`](https://git.coopcloud.tech/decentral1se/iroh-go/pulls/17/files#diff-6cb0de32597996783d2aaba15d6cf0b38590e440)?
<details><summary>Internals nerd zone</summary>
Sadly, iroh will not give us the `IrohError` directly from the API. That is what we want because it gives us the detailed error message in `IrohError.Message()`. So, we need to kind of wrap up some sort of convenient conversion and also preserve the `err != nil` checks that you usually expect. It's too verbose to have to do this every time we receive an `error` on the API consumer side. That's the `iroh.As` API. `errors.Is` is supported in general now.
</details>
Refs:
- https://github.com/n0-computer/iroh-ffi/pull/267
- https://antonz.org/accepted/errors-astype/
- https://git.coopcloud.tech/decentral1se/iroh-go/issues/10
@decentral1se hero! this looks really nice to use. really appreciate the added example as a way to document / learn how to use it
added a commit with some fixes i found while reading through the code cf4b3933e4
merge away!
@decentral1se hero! this looks really nice to use. really appreciate the added example as a way to document / learn how to use it
added a commit with some fixes i found while reading through the code https://git.coopcloud.tech/decentral1se/iroh-go/commit/cf4b3933e48f412f6e20620998234724b1bdd8e1
merge away!
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
@cblgh no rush on this. I have gone back and forth on this and I think it's ready for another pair of eyeballs. What do you think of the error checking API in
examples/errors/errors.go?Internals nerd zone
Sadly, iroh will not give us the `IrohError` directly from the API. That is what we want because it gives us the detailed error message in `IrohError.Message()`. So, we need to kind of wrap up some sort of convenient conversion and also preserve the `err != nil` checks that you usually expect. It's too verbose to have to do this every time we receive an `error` on the API consumer side. That's the `iroh.As` API. `errors.Is` is supported in general now.Refs:
18c424ee54to412c2f48ea@decentral1se hero! this looks really nice to use. really appreciate the added example as a way to document / learn how to use it
added a commit with some fixes i found while reading through the code
cf4b3933e4merge away!
9fc52d6c7eto55d5a1175455d5a11754to3b6f179add