Created
April 5, 2017 09:23
-
-
Save julianjelfs/cab12ba4206679bc6cde5f580ac844f5 to your computer and use it in GitHub Desktop.
Remote data responding to error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ResultsReceived data -> | |
| ( { model | data = data } | |
| , Cmd.none | |
| ) | |
| ResultsReceived (Failure err) -> | |
| ( { model | data = (Failure err)} | |
| , systemError (toString err) | |
| ) |
Author
I'd do this:
ResultsReceived data ->
( { model | data = data }
, case data of
Failure err -> systemError <| toString err
_ -> Cmd.none
)I'd also consider systemError : a -> Cmd msg.
(ie. let it do the toString for you).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am specifically handling the Failure case so that I can fire a Cmd that actually reports the error (via ports)