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

Allow deserialization error handling in fetch #36

Closed
glademiller opened this issue Jan 29, 2019 · 9 comments
Closed

Allow deserialization error handling in fetch #36

glademiller opened this issue Jan 29, 2019 · 9 comments
Labels
bug Something isn't working

Comments

@glademiller
Copy link

The Fetch module works great but it has a couple of expects where I would hope to have a Result that I can handle to say something went wrong with the request. Today you could do the string and Json deserialization manually and handle the errors but it would be nice if the built in functionality allowed for it.

@jesskfullwood
Copy link
Contributor

There was some discussion of this in the original PR. It should obviously be done but it seems the implementation will need some thought.

@glademiller
Copy link
Author

I totally agree. A solid solution wasn't super obvious or I would have opened a PR. Just for the sake of furthering the discussion my expectation was to be able to handle the error case and send a Msg just like I did for the success case.

@David-OConnor David-OConnor added the bug Something isn't working label Feb 1, 2019
@glademiller
Copy link
Author

Looking at the discussion it seems to revolve primarily around how to handle the two different error types. For my particular use case a new error type that has From implemented for both would be enough. What other options would seem to fit the situation? If an ideal solution could be hashed out I might be able to spare some time to put up a pr.

@sapir
Copy link
Contributor

sapir commented Mar 14, 2019

Futures are now returned from update, and their result needs to be Result<Msg, Msg>, so the error case is now passed as a Msg back to the update function.

@David-OConnor
Copy link
Member

David-OConnor commented Mar 22, 2019

@glademiller does sapir's latest PRs/the 3.0 release resolve this?

@glademiller
Copy link
Author

glademiller commented Mar 22, 2019 via email

@MartinKavik
Copy link
Member

I'll try to fix it.

@MartinKavik
Copy link
Member

@glademiller Merged PR #118 should resolve your problems - could you provide feedback or/and close the issue?

@glademiller
Copy link
Author

I haven't dug too deep but looking at the code I believe this solves the issues I had. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants