on master help sign in
update certain error message from to .
694ef8egrdvnl
Data/Aeson/Types/FromJSON.hs+3−3
@@ -893,7 +893,7 @@ parseFieldMaybe' = (.:!)
893-- E.g. @'explicitParseField' 'parseJSON1' :: ('FromJSON1' f, 'FromJSON' a) -> 'Object' -> 'Text' -> 'Parser' (f a)@
893-- E.g. @'explicitParseField' 'parseJSON1' :: ('FromJSON1' f, 'FromJSON' a) -> 'Object' -> 'Text' -> 'Parser' (f a)@
894explicitParseField :: (Value -> Parser a) -> Object -> Text -> Parser a
894explicitParseField :: (Value -> Parser a) -> Object -> Text -> Parser a
895explicitParseField p obj key = case H.lookup key obj of
895explicitParseField 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"
897 Just v -> p v <?> Key key
897 Just v -> p v <?> Key key
898{-# INLINE explicitParseField #-}
898{-# INLINE explicitParseField #-}
899
899
@@ -958,9 +958,9 @@ contextType = prependContext
958-- | "contents", where "tag" i-- |s associated to one of ["Foo", "Bar"],
958-- | "contents", where "tag" i-- |s associated to one of ["Foo", "Bar"],
959-- | The parser returned error was: could not find key "tag"
959-- | The parser returned error was: could not find key "tag"
960contextTag :: Text -> [String] -> Parser a -> Parser a
960contextTag :: Text -> [String] -> Parser a -> Parser a
961−contextTag tagKey cnames = modifyFailure (const
961+contextTag tagKey cnames = prependFailure
962 ("expected Object with key \"" ++ unpack tagKey ++ "\"" ++
962 ("expected Object with key \"" ++ unpack tagKey ++ "\"" ++
963− " associated to one of " ++ show cnames ++ "."))
963+ " associated to one of " ++ show cnames ++ ", ")
964
964
965-- | Add the name of the constructor being parsed to a parser's error messages.
965-- | Add the name of the constructor being parsed to a parser's error messages.
966contextCons :: ConName -> TypeName -> Parser a -> Parser a
966contextCons :: 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
6Error in $: parsing Types.Nullary failed, expected String, but encountered Array
6Error in $: parsing Types.Nullary failed, expected String, but encountered Array
7SomeType (tagged)
7SomeType (tagged)
8Error in $.contents: parsing Int failed, expected Number, but encountered Boolean
8Error in $.contents: parsing Int failed, expected Number, but encountered Boolean
9−Error in $: parsing Types.SomeType(Unary) failed, key "contents" 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 present
10+Error in $: parsing Types.SomeType(Record) failed, key "testone" not found
11Error in $.testone: parsing Double failed, unexpected Boolean
11Error in $.testone: parsing Double failed, unexpected Boolean
12Error in $.tag: parsing Types.SomeType failed, expected tag field to be one of ["nullary","unary","product","record","list"], but found tag "X"
12Error 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
14Error in $: parsing Types.SomeType failed, expected Object, but encountered Array
14Error in $: parsing Types.SomeType failed, expected Object, but encountered Array
15SomeType (single-field)
15SomeType (single-field)
16Error in $.unary: parsing Int failed, expected Number, but encountered Object
16Error in $.unary: parsing Int failed, expected Number, but encountered Object