diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-03-07 11:04:01 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-03-07 11:04:01 +0100 |
commit | b9bc7f90e1d1f1e4d4fd41870b4ed487636df7db (patch) | |
tree | d60a00357dbc218b8f7bde7c4befcc4231c44e62 | |
parent | 8cfa962005938cc441523ca55f3770fe55602036 (diff) | |
download | hakyll-b9bc7f90e1d1f1e4d4fd41870b4ed487636df7db.tar.gz |
Throw nice error in getResourceString
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index 79ebb5e..5fb7b01 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -181,8 +181,14 @@ getRouteFor = fromJob $ \identifier -> CompilerM $ do -- getResourceString :: Compiler Resource String getResourceString = fromJob $ \resource -> CompilerM $ do + let identifier = unResource resource provider <- compilerResourceProvider <$> ask - liftIO $ resourceString provider resource + if resourceExists provider identifier + then liftIO $ resourceString provider resource + else throwError $ error' identifier + where + error' id' = "Hakyll.Core.Compiler.getResourceString: resource " + ++ show id' ++ " not found" -- | Auxiliary: get a dependency -- |