summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-10-17 20:40:33 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-10-21 20:37:20 +0200
commit8f62c1ad5045564d8fd5ddafea877efc2d7fc803 (patch)
tree4994ec461fe9ec8bde13ea8fea3192604ea3ca4f /src/Run.hs
parente56577e4506c7db72aef9e273cfa00592ca20829 (diff)
Replace user error with custom error data typeHEADmaster
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Run.hs b/src/Run.hs
index 53a0275..33c4109 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -44,6 +44,7 @@ import System.Posix.Signals
import System.Process
import Config
+import Error
import GDB
import Network
import Network.Ip
@@ -117,7 +118,7 @@ runTest out opts gdefs test = do
when (optForce opts) $ removeDirectoryRecursive testDir `catchIOError` \e ->
if isDoesNotExistError e then return () else ioError e
exists <- doesPathExist testDir
- when exists $ ioError $ userError $ testDir ++ " exists"
+ when exists $ throwOtherError $ "test directory ‘" <> T.pack testDir <> "’ already exists"
createDirectoryIfMissing True testDir
failedVar <- newTVarIO Nothing
@@ -136,12 +137,12 @@ runTest out opts gdefs test = do
let path = takeWhile (/= '\n') cabalOut
return $ T.unpack $ T.unwords (T.pack path : args)
_ -> do
- ioError $ userError $ "failed to find ‘" <> T.unpack name <> "’ executable path using cabal"
+ throwOtherError $ "failed to find ‘" <> name <> "’ executable path using cabal"
| otherwise
-> return $ T.unpack arg
defaultTool <- case optDefaultTool opts of
Just tool -> evalTool tool
- Nothing -> ioError $ userError "No test tool defined"
+ Nothing -> throwOtherError "no test tool defined"
procTools <- mapM (sequence . fmap evalTool) $ optProcTools opts
mgdb <- if optGDB opts