summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2013-01-07 21:59:23 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2013-01-07 21:59:23 +0100
commit91da7902518e7a1eb5a386408a53ef04d19e3de6 (patch)
treebe38c85d72a2f17d946ea7e845d8fb5459807606 /src/Hakyll
parentb83b90b2667dbfd2cd208cd4ca41d893513ff800 (diff)
downloadhakyll-91da7902518e7a1eb5a386408a53ef04d19e3de6.tar.gz
Perform sanity check on returned Identifier
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Core/Runtime.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Hakyll/Core/Runtime.hs b/src/Hakyll/Core/Runtime.hs
index 4755a6a..cb0813b 100644
--- a/src/Hakyll/Core/Runtime.hs
+++ b/src/Hakyll/Core/Runtime.hs
@@ -6,7 +6,7 @@ module Hakyll.Core.Runtime
--------------------------------------------------------------------------------
import Control.Applicative ((<$>))
-import Control.Monad (filterM)
+import Control.Monad (filterM, unless)
import Control.Monad.Error (ErrorT, runErrorT, throwError)
import Control.Monad.Reader (ask)
import Control.Monad.RWS (RWST, runRWST)
@@ -27,6 +27,7 @@ import Hakyll.Core.Compiler.Require
import Hakyll.Core.Configuration
import Hakyll.Core.Dependencies
import Hakyll.Core.Identifier
+import Hakyll.Core.Item
import Hakyll.Core.Item.SomeItem
import Hakyll.Core.Logger (Logger, Verbosity)
import qualified Hakyll.Core.Logger as Logger
@@ -200,15 +201,20 @@ chase trail id'
-- Huge success
CompilerDone (SomeItem item) cwrite -> do
- -- TODO: Sanity check on itemIdentifier?
- let facts = compilerDependencies cwrite
+ -- Print some info
+ let facts = compilerDependencies cwrite
cacheHits
| compilerCacheHits cwrite <= 0 = "updated"
| otherwise = "cached "
-
- -- Print some info
Logger.message logger $ cacheHits ++ " " ++ show id'
+ -- Sanity check
+ unless (itemIdentifier item == id') $ throwError $
+ "The compiler yielded an Item with Identifier " ++
+ show (itemIdentifier item) ++ ", but we were expecting " ++
+ "an Item with Identifier " ++ show id' ++ " " ++
+ "(you probably want to call makeItem to solve this problem)"
+
-- Write if necessary
case runRoutes routes id' of
Nothing -> return ()