Skip to content

Commit 55c8498

Browse files
committed
Test decoding error message
1 parent 3453625 commit 55c8498

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Data/Argonaut/Decode/Class.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ instance decodeJsonJson :: DecodeJson Json where
117117

118118
toNonEmpty :: forall a f. (Plus f) => ({ head :: f a -> Maybe a, tail :: f a -> Maybe (f a) }) -> (f a) -> Either String (NonEmpty f a)
119119
toNonEmpty i a = case (Tuple (i.head a) (i.tail a)) of
120-
(Tuple Nothing _) -> Left "is empty."
120+
(Tuple Nothing _) -> Left " is empty."
121121
(Tuple (Just h) Nothing) -> Right $ singleton h
122122
(Tuple (Just h) (Just t)) -> Right $ h :| t
123123

124124
instance decodeJsonNonEmptyArray :: (DecodeJson a) => DecodeJson (NonEmpty Array a) where
125125
decodeJson
126-
= lmap ("Couldn't decode Array: " <> _)
127-
<<< (traverse decodeJson <=< (toNonEmpty { head : Arr.head, tail : Arr.tail } ) <=< decodeJArray)
126+
= lmap ("Couldn't decode NonEmpty Array: " <> _)
127+
<<< (traverse decodeJson <=< (lmap ("Array" <> _) <<< toNonEmpty { head : Arr.head, tail : Arr.tail } ) <=< decodeJArray)
128128

129129
instance decodeJsonNonEmptyList :: (DecodeJson a) => DecodeJson (NonEmpty List a) where
130130
decodeJson

0 commit comments

Comments
 (0)