diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-08 17:26:43 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-08 17:27:57 +0200 |
| commit | 29f1d1b22b240ee9ef3cf4b867bc7a663d8d3a6a (patch) | |
| tree | 9bbf6c53a3782c48f679a02e93fbe46908f44d34 /app | |
| parent | 22a9ade3409b40f644a5b79fc6f1e5b06419c507 (diff) | |
Improve error reporting
Diffstat (limited to 'app')
| -rw-r--r-- | app/Main.hs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/app/Main.hs b/app/Main.hs index 1617dd5..37844c9 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -36,10 +36,8 @@ repl' lineNo ls = do Just input -> do result <- lift $ runL ls $ runInlineScript' lineNo "<repl>" input case result of - Left (LException mp ex) -> do - outputStrLn $ case mp of - Just p -> p ++ " error: " ++ ex - Nothing -> "error: " ++ ex + Left ex -> do + outputStrLn $ foldStackMessage ex repl' (lineNo + 1) ls Right (_, LState { stateEnv = newEnv }) -> do repl' (lineNo + 1) ls { stateEnv = newEnv } @@ -86,9 +84,8 @@ main = do Just scriptFileName -> do result <- runL ls (runScriptFile scriptFileName) case result of - Left (LException mp ex) -> case mp of - Just p -> putStrLn $ p ++ " error: " ++ ex - Nothing -> putStrLn $ "error: " ++ ex + Left ex -> do + putStrLn $ foldStackMessage ex Right (_, LState { stateEnv = evaledEnv }) -> do when (configUseREPL config) $ runInputT defaultSettings $ repl ls { stateEnv = evaledEnv } |
