I have an update function such as:
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
NewImages (Ok images) ->
({model|images = images}, Cmd.none)
NewImages (Err error) ->
myFunction model
NewUsers (Ok users) ->
({model|users = users}, Cmd.none)
NewUsers (Err error) ->
myFunction model
[...]
and a function myFunction
that I would like to call every time I get an HTTP.Error.
Apparently, _
cannot be used to match only the beginning of a pattern like in
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
NewImages (Ok images) ->
({model|images = images}, Cmd.none)
NewUsers (Ok users) ->
({model|users = users}, Cmd.none)
_ (Err error) ->
myFunction model
[...]
So, what would be the proper way to match all Http.Error in my update function?