elmish / react

Elmish React extensions for writing SPA and Native apps
https://elmish.github.io/react
Other
104 stars 21 forks source link

Cmd.OfAsync* should log exceptions to console #51

Closed reinux closed 3 years ago

reinux commented 3 years ago

Description

I could have sworn I'd brought this up a while ago, but I can't find the issue. I think this is the right repo?

It was decided before that since the reaction to exceptions in asyncs is undefined anyway, Elmish/React shouldn't need to do anything, and there isn't anything wrong per se with it eating exceptions.

The idea of logging to console was floated as a compromise, and I'd like to request for that again. I'd just spent my night trying to figure out why my app wasn't loading, until I remembered that exceptions in async Cmds are simply eaten. An async call from init was silently crashing my app.

Exceptions in async are common, as they tend to deal with stateful and network code.

Repro code

async {
   failwith "This will be seen by no one at runtime, whether in debug or production; the program will simply stop."
}
|> Cmd.OfAsyncImmediate.result

Expected and actual results

Requested:

In debug mode, at least, the exception should be dumped to console.log.

Actual:

It just stops with no message or indication of what had happened, leaving the view in whatever state it was last in.

Related information

MangelMaxime commented 3 years ago

Hello @reinux,

I could have sworn I'd brought this up a while ago, but I can't find the issue. I think this is the right repo?

you are inside the react repository of Elmish.

I think you wanted to look at elmish repository and probably this issue: https://github.com/elmish/elmish/issues/204

et1975 commented 3 years ago

What Maxime said, but furthermore - check again the comments I left in the fable issue.

reinux commented 3 years ago

Ah, sorry about that. Looks like I somehow missed the discussion about obsoleting .result.