a25c802d5bcfd3750f03f2d46c8bad5412aea353
[opengl.git] / src / Language / Haskell / LSP / Test / Exceptions.hs
1 module Language.Haskell.LSP.Test.Exceptions where
2
3 import Control.Exception
4 import Language.Haskell.LSP.Messages
5
6 data SessionException = TimeoutException
7                       | UnexpectedMessageException String FromServerMessage
8
9 instance Exception SessionException
10
11 instance Show SessionException where
12   show TimeoutException = "Timed out waiting to receive a message from the server."
13   show (UnexpectedMessageException expected lastMsg) =
14     "Received an unexpected message from the server:\n" ++
15     "Expected: " ++ expected ++ "\n" ++
16     "Last message accepted: " ++ show lastMsg
17
18 anySessionException :: SessionException -> Bool
19 anySessionException = const True