on master help sign in
Improve prettyPrintParseException when context is empty
commit98636f10ffdbd0a79e77738e55883ca9eb4e07e9 authorSidharth Kapur <sidharthkapur1@gmail.com> dateMon 18 Jul 2016, 21:33 (10 years ago) parent5f520f4
1 file changed+6−4
Data/Yaml/Internal.hs+6−4
Data/Yaml/Internal.hs+6−4
@@ -88,11 +88,13 @@ prettyPrintParseException pe = case pe of
8888 Nothing -> "Unspecified YAML error"
8989 Just yamlError -> case yamlError of
9090 YamlException s -> "YAML exception:\n" ++ s
91− YamlParseException problem context mark -> unlines
91+ YamlParseException problem context mark -> concat
9292 [ "YAML parse exception at line " ++ show (yamlLine mark) ++
93− ", column " ++ show (yamlColumn mark) ++ ","
94− -- The context seems to include a leading "while" or similar.
95− , context ++ ":"
93+ ", column " ++ show (yamlColumn mark)
94+ , case context of
95+ "" -> ":\n"
96+ -- The context seems to include a leading "while" or similar.
97+ _ -> ",\n" ++ context ++ ":\n"
9698 , problem
9799 ]
98100 AesonException s -> "Aeson exception:\n" ++ s