-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Description
I wrote the following code to handle unwrapping Shake's exceptions thrown by the Shake runner:
-- | When we raise a 'GhcException' or a 'SourceError', try to give
-- @ghc --make@ compatible output (without the extra Shake wrapping.)
-- This is way better for users, since Shake does not print line numbers
-- for SourceErrors.
handleGhcErrors :: IO a -> IO a
handleGhcErrors m =
handle (\(e :: ShakeException) ->
-- TODO: there should be a better way of doing this
case fromException (shakeExceptionInner e) of
Just (e' :: GhcException) -> throwIO e'
Nothing -> case fromException (shakeExceptionInner e) of
Just (e' :: SourceError) -> throwIO e'
Nothing -> throwIO e
) m
This code only works when --no-time is passed; when it is not passed this code doesn't seem to work. I haven't investigated any further.
Metadata
Metadata
Assignees
Labels
No labels