- "Expected: " ++ expected ++ "\n" ++
- "Last message accepted: " ++ show lastMsg
- show (ReplayOutOfOrderException received expected) =
- "Replay is out of order:\n" ++
- "Received from server:" ++ show received ++ "\n" ++
- "Expected one of: " ++ concatMap show expected
- show UnexpectedDiagnosticsException = "Unexpectedly received diagnostics from the server."
- show (IncorrectApplyEditRequestException msgStr) = "ApplyEditRequest didn't contain document, instead received:\n"
+ "Was parsing: " ++ expected ++ "\n" ++
+ "Last message received:\n" ++ B.unpack (encodePretty lastMsg)
+ show (ReplayOutOfOrder received expected) =
+ let expected' = nub expected
+ getJsonDiff = lines . B.unpack . encodePretty
+ showExp exp = B.unpack (encodePretty exp) ++ "\nDiff:\n" ++
+ ppDiff (getGroupedDiff (getJsonDiff received) (getJsonDiff exp))
+ in "Replay is out of order:\n" ++
+ -- Print json so its a bit easier to update the session logs
+ "Received from server:\n" ++ B.unpack (encodePretty received) ++ "\n" ++
+ "Raw from server:\n" ++ B.unpack (encode received) ++ "\n" ++
+ "Expected one of:\n" ++ unlines (map showExp expected')
+ show UnexpectedDiagnostics = "Unexpectedly received diagnostics from the server."
+ show (IncorrectApplyEditRequest msgStr) = "ApplyEditRequest didn't contain document, instead received:\n"