File tree 3 files changed +9
-2
lines changed 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change
1
+ ## Version 0.5.3.0
2
+
3
+ * improve error messages for ` lookup ` and NamedRecord parsers.
4
+
1
5
## Version 0.5.2.0
2
6
3
7
* Add ` FromField ` /` ToField ` instances for ` Identity ` and ` Const ` (#158 )
Original file line number Diff line number Diff line change 1
1
cabal-version : 1.12
2
2
Name : cassava
3
- Version : 0.5.2 .0
3
+ Version : 0.5.3 .0
4
4
Synopsis : A CSV parsing and encoding library
5
5
Description : {
6
6
Original file line number Diff line number Diff line change @@ -1148,8 +1148,11 @@ unsafeIndex v idx = parseField (V.unsafeIndex v idx)
1148
1148
-- 'empty' if the field is missing or if the value cannot be converted
1149
1149
-- to the desired type.
1150
1150
lookup :: FromField a => NamedRecord -> B. ByteString -> Parser a
1151
- lookup m name = maybe (fail err) parseField $ HM. lookup name m
1151
+ lookup m name = maybe (fail err) parseField' $ HM. lookup name m
1152
1152
where err = " no field named " ++ show (B8. unpack name)
1153
+ parseField' fld = case runParser (parseField fld) of
1154
+ Left e -> fail $ " in named field " ++ show (B8. unpack name) ++ " : " ++ e
1155
+ Right res -> pure res
1153
1156
{-# INLINE lookup #-}
1154
1157
1155
1158
-- | Alias for 'lookup'.
You can’t perform that action at this time.
0 commit comments