on master help sign in
Hint for weird yaml error
292385bJasper Van der Jeugt
src/Hakyll/Core/Provider/Metadata.hs+13−2
@@ -1,6 +1,7 @@
1--------------------------------------------------------------------------------
1--------------------------------------------------------------------------------
2-- | Internal module to parse metadata
2-- | Internal module to parse metadata
3−{-# LANGUAGE BangPatterns #-}
3+{-# LANGUAGE BangPatterns #-}
4+{-# LANGUAGE RecordWildCards #-}
4module Hakyll.Core.Provider.Metadata
5module Hakyll.Core.Provider.Metadata
5 ( loadMetadata
6 ( loadMetadata
6 , parsePage
7 , parsePage
@@ -140,4 +141,14 @@ instance Exception MetadataException
140--------------------------------------------------------------------------------
141--------------------------------------------------------------------------------
141instance Show MetadataException where
142instance Show MetadataException where
142 show (MetadataException fp err) =
143 show (MetadataException fp err) =
143− fp ++ ": " ++ Yaml.prettyPrintParseException err
144+ fp ++ ": " ++ Yaml.prettyPrintParseException err ++ hint
145+
146+ where
147+ hint = case err of
148+ Yaml.InvalidYaml (Just (Yaml.YamlParseException {..}))
149+ | yamlProblem == problem -> "\n" ++
150+ "Hint: if the metadata value contains characters such\n" ++
151+ "as ':' or '-', try enclosing it in quotes."
152+ _ -> ""
153+
154+ problem = "mapping values are not allowed in this context"