Bence Ferdinandy: 1
collect all parse errors during Walk
1 files changed, 8 insertions(+), 5 deletions(-)
Thanks for the ping, and sorry for the delay.
No worries, I wasn't exactly super speedy in getting back here myself ^^
When you sent this patch, I've reworked it a bit [1] so that we don't
create long chains of nested errors (instead a single errors.Join),
fix a test failure and drop the error prefix (already included in the
existing errors).
That indeed looks better!
The reason I haven't pushed this is that I'm still wondering how to
handle errors from the user-provided callback. Right now callers expect
that an error returned from the callback will be passed as-is, but with
this patch it's no longer the case. I don't want to special-case the
situation where there is no format error but there is a callback error,
because this would result in unreliable error handling in the callers
(it would appear to work if there is no format failure, but would break
as soon as there is one).
Probably the way to go is to always wrap the error with errors.Join as
done in the branch, and document this as a breaking change?
I think yes, you are right, this is probably the best solution here. Users can
still parse the returned error themselves, so it shouldn't be a big deal to
update any downstream code.
Thanks,
Bence
[1]: https://github.com/emersion/go-maildir/compare/master...walk-err
I've added some docs and pushed the patch.
Great, thanks! Could I also convince you to tag a release for this? Unless of
course you see one coming soonish anyway. I could then patch aerc to use this.
Thanks,
Bence
Yes, done:
https://github.com/emersion/go-maildir/releases/tag/v0.5.0