I'm using App.programWithFlags to initialize the state of my model from
local storage (as described in this blog article
<https://medium.com/wunder-nerds/storing-and-restoring-the-state-in-elm-0-17-94874429dc1d>).
But when the schema of my model changes (ex: I added a new field to a
record type) it will correctly error out when Elm.Main.fullscreen is called
with error: "You are trying to initialize module `Main` with an unexpected
argument."
I am OK with throwing away the state from local storage and starting from
scratch when this happens, so I tried to add a try catch in the JavaScript
but surprisingly (to me) the catch doesn't fire.
try {
elmApp = Elm.Main.fullscreen(startingState);
}
catch (e) {
elmApp = Elm.Main.fullscreen(null); // this never gets called
}
Is there a way that I can catch this error? Or do I need to use a
different approach?
Thanks,
Kevin
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.