Skip to content

Commit

Permalink
Improve error message for --probe-tools (haskell#4387)
Browse files Browse the repository at this point in the history
When `getRuntimeGhcVersion'` throws an error, display that error
  • Loading branch information
sgillespie authored and soulomoon committed Sep 23, 2024
1 parent 3cfc896 commit f0b9500
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions exe/Wrapper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Main where

import Control.Monad.Extra
import Data.Default
import Data.Either.Extra (eitherToMaybe)
import Data.Foldable
import Data.List
import Data.List.Extra (trimEnd)
Expand Down Expand Up @@ -76,8 +75,11 @@ main = do
putStrLn $ showProgramVersionOfInterest programsOfInterest
putStrLn "Tool versions in your project"
cradle <- findProjectCradle' recorder False
ghcVersion <- runExceptT $ getRuntimeGhcVersion' cradle
putStrLn $ showProgramVersion "ghc" $ mkVersion =<< eitherToMaybe ghcVersion
runExceptT (getRuntimeGhcVersion' cradle) >>= \case
Left err ->
T.hPutStrLn stderr (prettyError err NoShorten)
Right ghcVersion ->
putStrLn $ showProgramVersion "ghc" $ mkVersion ghcVersion

VersionMode PrintVersion ->
putStrLn hlsVer
Expand Down

0 comments on commit f0b9500

Please sign in to comment.