summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Compiler.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-19 00:41:39 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-19 00:41:39 +0200
commitda3aa16c8bffe896082288902256b4454e9dc415 (patch)
tree9127a61b86836017bfb3cdd7681a8a9e32c0b9d6 /src/Hakyll/Core/Compiler.hs
parentdf1d77e5f1ed9782387f57ab376317e86789d48f (diff)
downloadhakyll-da3aa16c8bffe896082288902256b4454e9dc415.tar.gz
Better error messages for type errors
Diffstat (limited to 'src/Hakyll/Core/Compiler.hs')
-rw-r--r--src/Hakyll/Core/Compiler.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs
index 5ef3256..2164dda 100644
--- a/src/Hakyll/Core/Compiler.hs
+++ b/src/Hakyll/Core/Compiler.hs
@@ -217,16 +217,18 @@ getDependency id' = CompilerM $ do
store <- compilerStore <$> ask
result <- liftIO $ storeGet store "Hakyll.Core.Compiler.runCompiler" id'
case result of
- NotFound -> throwError notFound
- WrongType -> throwError wrongType
- Found x -> return x
+ NotFound -> throwError notFound
+ WrongType e r -> throwError $ wrongType e r
+ Found x -> return x
where
- notFound = "Hakyll.Core.Compiler.getDependency: " ++ show id'
- ++ " not found in the cache, the cache might be corrupted or"
- ++ " the item you are referring to might not exist"
- wrongType = "Hakyll.Core.Compiler.getDependency: " ++ show id'
- ++ " was found in the cache, but does not have the expected "
- ++ " type"
+ notFound =
+ "Hakyll.Core.Compiler.getDependency: " ++ show id' ++ " not found " ++
+ "not found in the cache, the cache might be corrupted or " ++
+ "the item you are referring to might not exist"
+ wrongType e r =
+ "Hakyll.Core.Compiler.getDependency: " ++ show id' ++ " was found " ++
+ "in the cache, but does not have the right type: expected " ++ show e ++
+ " but got " ++ show r
-- | Variant of 'require' which drops the current value
--