X-Git-Url: http://git.lukelau.me/?p=lsp-test.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FExceptions.hs;h=88cf57d11ed6910391856ed85ffe9b244fcc5e26;hp=dd31ea3cc155d879ba5366966b04e9b4ca5a4808;hb=16501021ea92ae3c84dbfd99a3c2dd631685b49c;hpb=f9b6ee2d5743d4b6a5d2ca6f492d1e2e731fe678 diff --git a/src/Language/Haskell/LSP/Test/Exceptions.hs b/src/Language/Haskell/LSP/Test/Exceptions.hs index dd31ea3..88cf57d 100644 --- a/src/Language/Haskell/LSP/Test/Exceptions.hs +++ b/src/Language/Haskell/LSP/Test/Exceptions.hs @@ -11,7 +11,7 @@ import Data.List import qualified Data.ByteString.Lazy.Char8 as B -- | An exception that can be thrown during a 'Haskell.LSP.Test.Session.Session' -data SessionException = Timeout +data SessionException = Timeout (Maybe FromServerMessage) | NoContentLengthHeader | UnexpectedMessage String FromServerMessage | ReplayOutOfOrder FromServerMessage [FromServerMessage] @@ -24,7 +24,11 @@ data SessionException = Timeout instance Exception SessionException instance Show SessionException where - show Timeout = "Timed out waiting to receive a message from the server." + show (Timeout lastMsg) = + "Timed out waiting to receive a message from the server." ++ + case lastMsg of + Just msg -> "\nLast message received: " ++ show msg + Nothing -> mempty show NoContentLengthHeader = "Couldn't read Content-Length header from the server." show (UnexpectedMessage expected lastMsg) = "Received an unexpected message from the server:\n" ++