austinmao / reduxity

React-redux via UniRx + Redux.NET for Unity3D
MIT License
50 stars 4 forks source link

ObservableWWW exception syntax #3

Open femanzo opened 7 years ago

femanzo commented 7 years ago

Hi! I noticed that the observableWWW error callback at the zenject example was giving me some strange logs, and I fixed it by following UniRx example where the catch exception comes before the subject inscription, like this:

ObservableWWW
    .Post(action.url, action.postData, action.headers)
    .CatchIgnore((WWWErrorException ex) => {
    dispatch(new ApiRequestor.Action.PostFailure {
        error = (ex.HasResponse ? ex.Text : ex.RawErrorMessage
    });
})
    .Subscribe(successText => {
    dispatch(new ApiRequestor.Action.PostSuccess {
        res = successText
    });
});

Thank you for the repo, it's really helping me in my learning process!