diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-05-25 11:27:22 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-05-30 16:44:08 -0400 |
commit | 18d3f01d9abe2994b2b3d07b67ee9616c3553e16 (patch) | |
tree | a7de4fa2dede37778bb82fe71b0650f356c9e6cf /compiler/main/DriverPipeline.hs | |
parent | 76c86fca43a4e5449f69c5bc1623f4890ae918e2 (diff) | |
download | haskell-18d3f01d9abe2994b2b3d07b67ee9616c3553e16.tar.gz |
Make downsweep return all errors per-module instead of throwing some
This enables API clients to handle such errors instead of immideately
crashing in the face of some kinds of user errors, which is arguably quite
bad UX.
Fixes #10887
Diffstat (limited to 'compiler/main/DriverPipeline.hs')
-rw-r--r-- | compiler/main/DriverPipeline.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index c8a1a9f704..9ac973cbc4 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1032,8 +1032,11 @@ runPhase (RealPhase (Hsc src_flavour)) input_fn dflags0 (hspp_buf,mod_name,imps,src_imps) <- liftIO $ do do buf <- hGetStringBuffer input_fn - (src_imps,imps,L _ mod_name) <- getImports dflags buf input_fn (basename <.> suff) - return (Just buf, mod_name, imps, src_imps) + eimps <- getImports dflags buf input_fn (basename <.> suff) + case eimps of + Left errs -> throwErrors errs + Right (src_imps,imps,L _ mod_name) -> return + (Just buf, mod_name, imps, src_imps) -- Take -o into account if present -- Very like -ohi, but we must *only* do this if we aren't linking |