feat: better error handling #17

Open
decentral1se wants to merge 1 commits from feat/errors into main
Owner

@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:

@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 added 1 commit 2026-07-23 15:58:06 +00:00
decentral1se force-pushed feat/errors from 18c424ee54 to 412c2f48ea 2026-07-23 15:58:06 +00:00 Compare
decentral1se marked the pull request as ready for review 2026-07-23 15:58:16 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/errors:feat/errors
git checkout feat/errors
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: decentral1se/iroh-go#17