Better error reporting
authorJoachim Breitner <mail@joachim-breitner.de>
Sat, 5 Jul 2008 13:44:17 +0000 (13:44 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Sat, 5 Jul 2008 13:44:17 +0000 (13:44 +0000)
Partty.hs

index 2e57a4a..fbf025f 100644 (file)
--- a/Partty.hs
+++ b/Partty.hs
@@ -314,7 +314,11 @@ parseNight h = do
                                loop $ playerpos
                        (InternalMessage (GotScore score)) ->
                                return (playerpos, score)
-                       _ -> error $ "Unexpected event at night"
+                       (InternalMessage m)
+                               -> error $ "Unexpected event at night: " ++ show m
+                       (DayMessage  m)
+                               -> error $ "Unexpected event at night: " ++ show m
+                       _       -> error $ "Unexpected event at night"
                ) []
        friends <- fix (\loop friends -> do
                msg <- getNextMessage h
@@ -325,7 +329,11 @@ parseNight h = do
                                loop $ friends
                        (InternalMessage (NightEnds)) ->
                                return friends
-                       _ -> error $ "Unexpected event at night"
+                       (InternalMessage m)
+                               -> error $ "Unexpected event at night: " ++ show m
+                       (DayMessage  m)
+                               -> error $ "Unexpected event at night: " ++ show m
+                       _       -> error $ "Unexpected event at night"
                ) []
        return $ NightMessage $ NightResult
                { nrPartyAt = partyAt