AsyncExtensions
AsyncExtensions copied to clipboard
opeators: add a MapError opeator
Description
This PR adds MapError Operator, which is transforms error upstream emits
Checklist
- [ ] this PR is based on the main branch and is up-to-date, if not please rebase your branch on the top of main
- [ ] the commits inside this PR have explicit commit messages
- [ ] unit tests cover the new feature or the bug fix
- [ ] the feature is documented in the README.md if it makes sense
- [ ] the CHANGELOG is up-to-date
Hi @JCSooHwanCho
Thanks for this PR.
Mmmmh, I'm not sure if this is useful to be able to map the error since an AsyncSequence, unlike a Combine publisher, is not parametrised by a Failure type.
In the end we still have to handle all kinds of Errors in the catch section. The mapError does not bring type safety here.
Do you see a big advantage to that ?
@twittemb I needed some functionality that catch some error and change it to another Error. so first I thought was mapError operator in Combine, implement and use it. but by your comment, catch operator in RxSwift is rather nicer than mapError with AsyncSequence case.
@JCSooHwanCho I have introduced a .mapToResult operator (main branch), it might be more versatile