Skip to content

Commit 2a61085

Browse files
committed
backward compatible encoding for missing NetworkError
1 parent 4386dd8 commit 2a61085

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Simplex/Messaging/Protocol.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2258,7 +2258,11 @@ $(J.deriveJSON defaultJSON ''MsgFlags)
22582258

22592259
$(J.deriveJSON (sumTypeJSON id) ''CommandError)
22602260

2261-
$(J.deriveJSON (sumTypeJSON $ dropPrefix "NE") ''NetworkError)
2261+
$(J.deriveToJSON (sumTypeJSON $ dropPrefix "NE") ''NetworkError)
2262+
2263+
instance FromJSON NetworkError where
2264+
parseJSON = $(J.mkParseJSON (sumTypeJSON $ dropPrefix "NE") ''NetworkError)
2265+
omittedField = Just NEFailedError
22622266

22632267
$(J.deriveJSON (sumTypeJSON id) ''BrokerErrorType)
22642268

0 commit comments

Comments
 (0)