Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opeators: add a MapError opeator #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JCSooHwanCho
Copy link

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

@twittemb
Copy link
Contributor

twittemb commented Mar 30, 2022

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 ?

@JCSooHwanCho
Copy link
Author

JCSooHwanCho commented Apr 10, 2022

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

@twittemb
Copy link
Contributor

@JCSooHwanCho I have introduced a .mapToResult operator (main branch), it might be more versatile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants