summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Provider
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2016-04-06 15:03:54 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2016-04-06 15:03:54 +0200
commit292385b7e5eb265032983f0669e5050b4fa89557 (patch)
tree3d2c83739a74fa4cd168cf85ae63adf7488141dc /src/Hakyll/Core/Provider
parentb903bd3014fe99f533037d474787567b3e41de9e (diff)
downloadhakyll-292385b7e5eb265032983f0669e5050b4fa89557.tar.gz
Hint for weird yaml error
Diffstat (limited to 'src/Hakyll/Core/Provider')
-rw-r--r--src/Hakyll/Core/Provider/Metadata.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Hakyll/Core/Provider/Metadata.hs b/src/Hakyll/Core/Provider/Metadata.hs
index 97dbc9e..ca1cc6c 100644
--- a/src/Hakyll/Core/Provider/Metadata.hs
+++ b/src/Hakyll/Core/Provider/Metadata.hs
@@ -1,6 +1,7 @@
--------------------------------------------------------------------------------
-- | Internal module to parse metadata
-{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE RecordWildCards #-}
module Hakyll.Core.Provider.Metadata
( loadMetadata
, parsePage
@@ -140,4 +141,14 @@ instance Exception MetadataException
--------------------------------------------------------------------------------
instance Show MetadataException where
show (MetadataException fp err) =
- fp ++ ": " ++ Yaml.prettyPrintParseException err
+ fp ++ ": " ++ Yaml.prettyPrintParseException err ++ hint
+
+ where
+ hint = case err of
+ Yaml.InvalidYaml (Just (Yaml.YamlParseException {..}))
+ | yamlProblem == problem -> "\n" ++
+ "Hint: if the metadata value contains characters such\n" ++
+ "as ':' or '-', try enclosing it in quotes."
+ _ -> ""
+
+ problem = "mapping values are not allowed in this context"