summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-10-30 23:52:09 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-10-30 23:52:09 +0100
commit0a5e375ecbd69c634b8faaf75768349088e60570 (patch)
tree590790d8b26bee8ec2e08253d0e6f06439f61dcc
parentAdd verbose logging. (diff)
downloadvimwiki-scripts-0a5e375ecbd69c634b8faaf75768349088e60570.tar.gz
vimwiki-scripts-0a5e375ecbd69c634b8faaf75768349088e60570.tar.xz
Crash with error message when data files are missing.
-rw-r--r--hs/src/Html.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/hs/src/Html.hs b/hs/src/Html.hs
index 5235a42..a45f4b1 100644
--- a/hs/src/Html.hs
+++ b/hs/src/Html.hs
@@ -289,8 +289,9 @@ copyFromDatadir :: FilePath -> [FilePath] -> FilePath -> IO ()
copyFromDatadir filename datadirs destination = do
let candidates = datadirs <&> (</> filename)
existing <- filterM doesFileExist candidates
- let source = head existing
- copyFile source destination
+ case existing of
+ [] -> error $ filename <> " not found in any of " <> show datadirs
+ source:_ -> copyFile source destination
main = do