summaryrefslogtreecommitdiff
path: root/src/Main.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/Main.hs
parente56577e4506c7db72aef9e273cfa00592ca20829 (diff)
Replace user error with custom error data typeHEADmaster
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs
index aada687..8e89f7c 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -20,6 +20,7 @@ import System.Posix.Terminal
import System.Posix.Types
import Config
+import Error
import JUnit
import Output
import Parser.Core
@@ -180,14 +181,14 @@ main = do
-> case conftool of
ToolPath cpath -> return $ ToolPath $ baseDir </> cpath
ToolCabal ccabal -> return $ ToolCabal ccabal
- | otherwise -> fail "no test tool defined"
+ | otherwise -> throwOtherError "no test tool defined"
case defaultTool of
ToolPath tpath -> case words tpath of
(path : _) -> getPermissions path >>= \perms -> do
when (not $ executable perms) $ do
- fail $ "‘" <> path <> "’ is not executable"
- _ -> fail $ "invalid tool argument: ‘" <> tpath <> "’"
+ throwOtherError $ "‘" <> T.pack path <> "’ is not executable"
+ _ -> throwOtherError $ "invalid tool argument: ‘" <> T.pack tpath <> "’"
ToolCabal _ -> return ()
files <- if not (null ofiles)
@@ -197,7 +198,7 @@ main = do
(path, _) -> (path, Nothing)
else map (, Nothing) <$> maybe (return []) (getConfigTestFiles) config
- when (null files) $ fail $ "No test files"
+ when (null files) $ throwOtherError $ "no test files"
useColor <- case optColor opts of
Just use -> return use