-
Notifications
You must be signed in to change notification settings - Fork 50
Display FFI errors to user #268
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ module Try.Loader | |
import Prelude | ||
|
||
import Control.Bind (bindFlipped) | ||
import Control.Monad.Except (ExceptT) | ||
import Control.Monad.Except (ExceptT, throwError) | ||
import Control.Parallel (parTraverse) | ||
import Data.Array as Array | ||
import Data.Array.NonEmpty as NonEmpty | ||
|
@@ -112,7 +112,7 @@ makeLoader rootPath = Loader (go Object.empty <<< parseDeps "<file>") | |
deps = { name: _, path: Nothing } <$> shim.deps | ||
pure { name, path, deps, src } | ||
Nothing -> | ||
pure { name, path, deps: [], src: ffiDep name } | ||
throwError ("FFI dependency not provided: " <> name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just copied the error message from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe:
(Adapted from #265 (comment) 🙂 ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps: "We don't provide FFI shims for all libraries; for example, Node libraries are not supported on Try PureScript. If you would like to suggest a new FFI shim be supported, please open an issue." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine to surface this error in the iframe instead of only in the console. However, if we find a better place to put it in the future, then I'm happy to move it around! |
||
liftEffect $ putModule name mod | ||
pure mod | ||
|
||
|
@@ -130,6 +130,3 @@ makeLoader rootPath = Loader (go Object.empty <<< parseDeps "<file>") | |
# bindFlipped _.deps | ||
# Array.nubBy (comparing _.name) | ||
# go ms' | ||
|
||
ffiDep :: String -> JS | ||
ffiDep name = JS $ "throw new Error('FFI dependency not provided: " <> name <> "');" |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, just realized why we weren't hitting this case even if we pass a bad
loaderUrl
. This linetrypurescript/client/src/Try/Container.purs
Line 202 in a989a85
loader
.