-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ghcjs-dom-jsffi JS exceptions can not be caught in Haskell #78
Comments
My understanding is that it results in larger (probably slower) JavaScript as it has to wrap each call with |
A function where it was already a problem for me was RTCPeerConnection.close which throws if the connection was already closed. I will checkout the IDL files, whether they say anything about exceptions. Otherwise I will try to write some benchmark to check for performance implications. |
Are you sure it was |
I am afraid so, at least on Chrome. But as I just checked, it does not seem to be a standard conform behavior! According to the spec, step 2 says:
so it should not throw, but just do nothing. I will file a bug in Chromium about that! |
Ok, I just rechecked:
I am going to file a bug report. |
Bug got fixed. Ok, I think the way to go forward would be to import functions marked throwing in the idl files as safe and all others as unsafe. My colleague and I will try to provide a PR soon. |
According to the ghcjfs-ffi this should be easily fixable by using a
safe
foreign import as opposed to anunsafe
one.Is the fix really this easy? Are there any good reasons why everything gets imported
unsafe
?Note: with jsaddle and ghc JS exceptions can be handled just fine.
The text was updated successfully, but these errors were encountered: