Then people can errors.Is(...) (or whatever) directly to check without the casting. I don't actually see this exposed in the API via the docs: https://godocs.io/git.coopcloud.tech/decentral1se/iroh-go so there might need to be some automagic conversion done 🤔
It would be nice if we could avoid the thing we're doing as it's a bit clunky:
```go
if err != nil {
irohErr := &iroh.IrohError{}
if ok := errors.As(err, irohErr); ok {
panic(irohErr.Message())
} else {
panic(err)
}
}
```
And instead just expose the error types directly:
> https://github.com/n0-computer/iroh-ffi/blob/87509053e1dbe1e561c4abb0cd08481441c0edcb/src/error.rs#L39-L57
Then people can `errors.Is(...)` (or whatever) directly to check without the casting. I don't actually see this exposed in the API via the docs: https://godocs.io/git.coopcloud.tech/decentral1se/iroh-go so there might need to be some automagic conversion done 🤔
We need everything that should be IrohError to be typed as IrohError and not error. That is the first step. Then we can implement errors.Is for IrohError to match against the whole family of errors that come from the iroh side. We can build the errors out as concrete types as we come across them.
If upstream can't help with a change, we can try to hack the bindings again 😬 Waiting for now...
I've raised it upstream: https://github.com/n0-computer/iroh-ffi/issues/263
We need everything that should be `IrohError` to be typed as `IrohError` and not `error`. That is the first step. Then we can implement `errors.Is` for `IrohError` to match against the whole family of errors that come from the `iroh` side. We can build the errors out as concrete types as we come across them.
If upstream can't help with a change, we can try to hack the bindings again 😬 Waiting for now...
This can now be integrated 🪇I'm just not sure if there is a release coming soon or not. For now, we can build off of a commit and get a draft out on our side also. Super cool stuff!
This can now be integrated 🪇 ~~I'm just not sure if there is a release coming soon or not. For now, we can build off of a commit and get a draft out on our side also. Super cool stuff!~~
> https://github.com/n0-computer/iroh-ffi/pull/267
**edit**: release has dropped: https://github.com/n0-computer/iroh-ffi/releases/tag/v1.1.0
Running out of time just now but I've [merged the latest `v1.1.0` release](https://git.coopcloud.tech/decentral1se/iroh-go/commit/68ad06fe2a2507afd217e88d18a967204d5b8935) in and updated the examples to build from the latest HEAD and everything is still working! What is now is to write the wrapper for more ergonomic errors following the tips in https://github.com/n0-computer/iroh-ffi/issues/263#issuecomment-4925687805. Unless someone gets to it first, I'll take a crack shortly.
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.
It would be nice if we could avoid the thing we're doing as it's a bit clunky:
And instead just expose the error types directly:
Then people can
errors.Is(...)(or whatever) directly to check without the casting. I don't actually see this exposed in the API via the docs: https://godocs.io/git.coopcloud.tech/decentral1se/iroh-go so there might need to be some automagic conversion done 🤔yeah i was thinking of this too! big fan of being able to use errors.Is if possible
I've raised it upstream: https://github.com/n0-computer/iroh-ffi/issues/263
We need everything that should be
IrohErrorto be typed asIrohErrorand noterror. That is the first step. Then we can implementerrors.IsforIrohErrorto match against the whole family of errors that come from theirohside. We can build the errors out as concrete types as we come across them.If upstream can't help with a change, we can try to hack the bindings again 😬 Waiting for now...
This can now be integrated 🪇
I'm just not sure if there is a release coming soon or not. For now, we can build off of a commit and get a draft out on our side also. Super cool stuff!edit: release has dropped: https://github.com/n0-computer/iroh-ffi/releases/tag/v1.1.0
Running out of time just now but I've merged the latest
v1.1.0release in and updated the examples to build from the latest HEAD and everything is still working! What is now is to write the wrapper for more ergonomic errors following the tips in https://github.com/n0-computer/iroh-ffi/issues/263#issuecomment-4925687805. Unless someone gets to it first, I'll take a crack shortly.decentral1se referenced this issue2026-07-22 18:17:20 +00:00