diff options
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index ae9fbf1..42b24d6 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -28,7 +28,7 @@ module Hakyll.Core.Compiler -------------------------------------------------------------------------------- -import Control.Monad (when) +import Control.Monad (when, unless) import Data.Binary (Binary) import Data.ByteString.Lazy (ByteString) import Data.Typeable (Typeable) @@ -149,6 +149,10 @@ cached name compiler = do id' <- compilerUnderlying <$> compilerAsk store <- compilerStore <$> compilerAsk provider <- compilerProvider <$> compilerAsk + + -- Give a better error message when the resource is not there at all. + unless (resourceExists provider id') $ fail $ itDoesntEvenExist id' + let modified = resourceModified provider id' if modified then do @@ -166,6 +170,11 @@ cached name compiler = do "Hakyll.Core.Compiler.cached: Cache corrupt! " ++ "Try running: " ++ progName ++ " clean" + itDoesntEvenExist id' = + "Hakyll.Core.Compiler.cached: You are trying to (perhaps " ++ + "indirectly) use `cached` on a non-existing resource: there " ++ + "is no file backing " ++ show id' + -------------------------------------------------------------------------------- unsafeCompiler :: IO a -> Compiler a |