pkamenarsky / replica

A remote virtual DOM library for Haskell
BSD 3-Clause "New" or "Revised" License
139 stars 14 forks source link

Notify user when an exception occured #5

Open kamoii opened 5 years ago

kamoii commented 5 years ago

When the step function throws an exception, websocket handlers just exist causing the websocket to close. From the users point of view, the site suddenly not responding anymore.

In such case, showing an alert message(e.g. "Error has occured. Please reload the page.") would be better.

pkamenarsky commented 5 years ago

Note to self: exceptions in lifted IO still won't get caught, since they will be thrown inside the widget's individual thread:

exWidget :: Widget HTML a
exWidget = do
  e <- div [ onClick ] [ text "BOOM" ]
  a <- liftIO $ evaluate ((5 `P.div` 0))
  text $ T.pack $ show "Done"
  exWidget

This exception won't be caught in websocketApp yet: I'll need to patch concur-core for that to work first.