aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2022-09-27 15:45:38 +0300
committerJan Tuomi <jans.tuomi@gmail.com>2022-12-05 14:21:53 +0200
commit3b1144988c49c1221b1c5f6b8f7544f1dea7cb44 (patch)
tree1dbba923dbe11ada9e7138ad64e7272fe35553ab /app
parent0a56af62ffa95360587728b82c947a2936743a4c (diff)
Show position info in error messages
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs
index be5bdf3..d8fcb61 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -29,8 +29,10 @@ repl config env = do
Just input -> do
result <- lift $ runL config (runInlineScript "<repl>" env input)
case result of
- Left (LException ex) -> do
- outputStrLn $ "Error: " ++ ex
+ Left (LException mp ex) -> do
+ outputStrLn $ case mp of
+ Just p -> p ++ " error: " ++ ex
+ Nothing -> "error: " ++ ex
repl config env
Right (newEnv, _) -> do
repl config newEnv
@@ -65,7 +67,9 @@ main = do
Just scriptFileName -> do
result <- runL config (runScriptFile builtinEnv scriptFileName)
case result of
- Left (LException ex) -> putStrLn $ "Error: " ++ ex
+ Left (LException mp ex) -> case mp of
+ Just p -> putStrLn $ p ++ " error: " ++ ex
+ Nothing -> putStrLn $ "error: " ++ ex
Right _ -> return ()
Nothing -> do
putStrLn $ "Lang REPL"