git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
psc-bundle: include detail from language-javascript

If language-javascript cannot parse a javascript file as part of psc-bundle, the error message is now included in the error that psc-bundle emits.

commit65c77186fd2f5862cc70ff028924253e6c919e48 authorHarry Garrood <harry@garrood.me> dateSat 25 Jul 2015, 20:20 (11 years ago) parent184d97f
1 file changed+6−4
src/Language/PureScript/Bundle.hs+6−4
src/Language/PureScript/Bundle.hs+6−4
@@ -50,7 +50,7 @@ import qualified Paths_purescript as Paths
5050data ErrorMessage
5151 = UnsupportedModulePath String
5252 | InvalidTopLevel
53− | UnableToParseModule
53+ | UnableToParseModule String
5454 | UnsupportedExport
5555 | ErrorInModule ModuleIdentifier ErrorMessage
5656 deriving Show
@@ -109,8 +109,10 @@ printErrorMessage (UnsupportedModulePath s) =
109109 ]
110110printErrorMessage InvalidTopLevel =
111111 [ "Expected a list of source elements at the top level." ]
112−printErrorMessage UnableToParseModule =
113− [ "The module could not be parsed." ]
112+printErrorMessage (UnableToParseModule err) =
113+ [ "The module could not be parsed:"
114+ , err
115+ ]
114116printErrorMessage UnsupportedExport =
115117 [ "An export was unsupported. Exports can be defined in one of two ways: "
116118 , " 1) exports.name = ..."
@@ -530,7 +532,7 @@ bundle :: forall m. (Applicative m, MonadError ErrorMessage m)
530532 -> m String
531533bundle inputStrs entryPoints mainModule namespace = do
532534 input <- forM inputStrs $ \(ident, js) -> do
533− ast <- either (const $ throwError $ ErrorInModule ident UnableToParseModule) pure $ parse js (moduleName ident)
535+ ast <- either (throwError . ErrorInModule ident . UnableToParseModule) pure $ parse js (moduleName ident)
534536 return (ident, ast)
535537
536538 let mids = S.fromList (map (moduleName . fst) input)