Skip to content

Commit

Permalink
Merge pull request #89 from sid-kap/improve-prettyPrintParseException
Browse files Browse the repository at this point in the history
Improve prettyPrintParseException when context is empty
  • Loading branch information
snoyberg committed Jul 19, 2016
2 parents 5f520f4 + 98636f1 commit 0816ef3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Data/Yaml/Internal.hs
Expand Up @@ -88,11 +88,13 @@ prettyPrintParseException pe = case pe of
Nothing -> "Unspecified YAML error"
Just yamlError -> case yamlError of
YamlException s -> "YAML exception:\n" ++ s
YamlParseException problem context mark -> unlines
YamlParseException problem context mark -> concat
[ "YAML parse exception at line " ++ show (yamlLine mark) ++
", column " ++ show (yamlColumn mark) ++ ","
-- The context seems to include a leading "while" or similar.
, context ++ ":"
", column " ++ show (yamlColumn mark)
, case context of
"" -> ":\n"
-- The context seems to include a leading "while" or similar.
_ -> ",\n" ++ context ++ ":\n"
, problem
]
AesonException s -> "Aeson exception:\n" ++ s
Expand Down

0 comments on commit 0816ef3

Please sign in to comment.