Closed Wizek closed 7 years ago
Thank you for the detailed report! I think this is more than enough to reproduce the issue.
My guess is that one of the dependencies (perhaps snap
or stm
) has changed with regards to exceptions. Exceptions are always a bit troublesome in a multi-threaded environment or when using monad transformers.
Probably related to #143 .
I think that this is a problem with the Snap framework. The latest commit mentioned here works around this quirk by printing any exception to stdout. Does this help?
Hey @HeinrichApfelmus, I've tested it briefly, and it works like a charm! Thanks a lot for figuring out and including this workaround
I hope to test it further in the coming days and if all is well close this issue.
@HeinrichApfelmus,
I've found another error case:
import qualified Graphics.UI.Threepenny as UI
import Graphics.UI.Threepenny.Core
main = startGUI defaultConfig $ \w -> do
getBody w #+ [UI.h1 # set UI.text "before error"]
div <- UI.div # set UI.text (error "This error should be shown")
getBody w #+ [UI.h1 # set UI.text "after error"]
return ()
The websocket connection gets terminated and the following is printed to stdout:
Foreign.JavaScript: Browser window disconnected.
No other detail or context is shown about the exception.
Do you think this case is also related to snapframework/snap-server#94?
Edit: Tried with both 14e78bd (2016-12-07) and 95a90ad (2016-12-10).
Ah, I see, thanks a lot for the report. The problem is that this exception is from a pure value (String
), which is evaluated in a different part of the code than the other exception handling code. I will fix this.
I have addressed this in the most recent commit f4ac93e5d5d5ea1aa1f7a827d34a4f0f28f95e70 . Does this help?
I was about to report this, good to see it is getting fixed !
Expected terminal output, as with 0.6.0.5, showing an uncaught exception:
Instead, output with 0.7.0.0 is like so, no mention of the exception:
To reproduce with 0.7.0.0:
Put the above code in a file, make the file executable, make sure nix is installed, and execute the file. Once the server has started up, visit http://127.0.0.1:8023/ .
(Note: Nix was used so that the example above may be as self-contained as possible; however it is not strictly necessary to reproduce the issue if one makes sure (e.g. with Cabal or Stack) to use the correct version of the
threepenny-gui
package.)nixos-unstable.tar.gz
may be changed in the above code tonixos-15.09.tar.gz
to run withthreepenny-gui-0.6.0.5
.This may already be more than enough information for the issue to be identified; in case however that's not so, please let me know.