on master help sign in
update certain error message from to .
commit694ef8ebfb60f68c8aa08dbe6685b74ecbae2b8f authorgrdvnl <grdvnl@gmail.com> dateTue 15 Oct 2019, 05:33 (7 years ago) parentf5e5073
2 files changed+6−6
Data/Aeson/Types/FromJSON.hs+3−3 tests/golden/generic.expected+3−3
Data/Aeson/Types/FromJSON.hs+3−3
@@ -893,7 +893,7 @@ parseFieldMaybe' = (.:!)
893893-- E.g. @'explicitParseField' 'parseJSON1' :: ('FromJSON1' f, 'FromJSON' a) -> 'Object' -> 'Text' -> 'Parser' (f a)@
894894explicitParseField :: (Value -> Parser a) -> Object -> Text -> Parser a
895895explicitParseField p obj key = case H.lookup key obj of
896− Nothing -> fail $ "key " ++ show key ++ " not present"
896+ Nothing -> fail $ "key " ++ show key ++ " not found"
897897 Just v -> p v <?> Key key
898898{-# INLINE explicitParseField #-}
899899
@@ -958,9 +958,9 @@ contextType = prependContext
958958-- | "contents", where "tag" i-- |s associated to one of ["Foo", "Bar"],
959959-- | The parser returned error was: could not find key "tag"
960960contextTag :: Text -> [String] -> Parser a -> Parser a
961−contextTag tagKey cnames = modifyFailure (const
961+contextTag tagKey cnames = prependFailure
962962 ("expected Object with key \"" ++ unpack tagKey ++ "\"" ++
963− " associated to one of " ++ show cnames ++ "."))
963+ " associated to one of " ++ show cnames ++ ", ")
964964
965965-- | Add the name of the constructor being parsed to a parser's error messages.
966966contextCons :: ConName -> TypeName -> Parser a -> Parser a
tests/golden/generic.expected+3−3
@@ -6,11 +6,11 @@ Error in $: parsing Types.Nullary failed, expected one of the tags ["C1","C2","C
66Error in $: parsing Types.Nullary failed, expected String, but encountered Array
77SomeType (tagged)
88Error in $.contents: parsing Int failed, expected Number, but encountered Boolean
9−Error in $: parsing Types.SomeType(Unary) failed, key "contents" not present
10−Error in $: parsing Types.SomeType(Record) failed, key "testone" not present
9+Error in $: parsing Types.SomeType(Unary) failed, key "contents" not found
10+Error in $: parsing Types.SomeType(Record) failed, key "testone" not found
1111Error in $.testone: parsing Double failed, unexpected Boolean
1212Error in $.tag: parsing Types.SomeType failed, expected tag field to be one of ["nullary","unary","product","record","list"], but found tag "X"
13−Error in $: parsing Types.SomeType failed, expected Object with key "tag" associated to one of ["nullary","unary","product","record","list"].
13+Error in $: parsing Types.SomeType failed, expected Object with key "tag" associated to one of ["nullary","unary","product","record","list"], key "tag" not found
1414Error in $: parsing Types.SomeType failed, expected Object, but encountered Array
1515SomeType (single-field)
1616Error in $.unary: parsing Int failed, expected Number, but encountered Object