From bbc2ff0bf5103bd1c93d68268876acd3cde028c6 Mon Sep 17 00:00:00 2001 From: Denis Tereshkin Date: Wed, 28 Sep 2016 10:39:16 +0700 Subject: [PATCH] Fixed non-exhaustive pattern matching in Broker.Protocol --- src/ATrade/Broker/Protocol.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ATrade/Broker/Protocol.hs b/src/ATrade/Broker/Protocol.hs index d3c226a..253393b 100644 --- a/src/ATrade/Broker/Protocol.hs +++ b/src/ATrade/Broker/Protocol.hs @@ -35,6 +35,7 @@ instance FromJSON BrokerServerRequest where orderId <- obj .: "cancel-order" RequestCancelOrder sqnum <$> parseJSON orderId | HM.member "request-notifications" obj = return (RequestNotifications sqnum) + parseRequest _ _ = fail "Invalid request object" instance ToJSON BrokerServerRequest where toJSON (RequestSubmitOrder sqnum order) = object ["request-sqnum" .= sqnum, @@ -87,6 +88,7 @@ instance FromJSON Notification where ns <- os .: "new-state" return $ OrderNotification oid ns) v Nothing -> fail "Should be order-state" + parseOrder _ = fail "Unable to parse order state" instance ToJSON Notification where toJSON (OrderNotification oid newState) = object ["order-state" .= object [ "order-id" .= oid, "new-state" .= newState] ]