From 292385b7e5eb265032983f0669e5050b4fa89557 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 6 Apr 2016 15:03:54 +0200 Subject: Hint for weird yaml error --- src/Hakyll/Core/Provider/Metadata.hs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/Hakyll') 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" -- cgit v1.2.3