@@ -182,25 +182,25 @@ canonicalizeUri uri = filePathToUri <$> canonicalizePath (fromJust (uriToFilePat
182182diagnostic :: Session (NotificationMessage TextDocumentPublishDiagnostics )
183183diagnostic = LspTest. message STextDocumentPublishDiagnostics
184184
185- callTestPlugin :: (A. FromJSON b ) => TestRequest -> Session ( Either ResponseError b )
185+ callTestPlugin :: (A. FromJSON b ) => TestRequest -> Session b
186186callTestPlugin cmd = do
187187 let cm = SCustomMethod " test"
188188 waitId <- sendRequest cm (A. toJSON cmd)
189189 ResponseMessage {_result} <- skipManyTill anyMessage $ responseForId cm waitId
190- return $ do
191- e <- _result
192- case A. fromJSON e of
193- A. Error e -> Left $ ResponseError InternalError ( T. pack e) Nothing
194- A. Success a -> pure a
190+ return $ case _result of
191+ Left ( ResponseError t err _) -> error $ show t <> " : " <> T. unpack err
192+ Right json -> case A. fromJSON json of
193+ A. Success a -> a
194+ A. Error e -> error e
195195
196- waitForAction :: String -> TextDocumentIdentifier -> Session ( Either ResponseError WaitForIdeRuleResult )
196+ waitForAction :: String -> TextDocumentIdentifier -> Session WaitForIdeRuleResult
197197waitForAction key TextDocumentIdentifier {_uri} =
198198 callTestPlugin (WaitForIdeRule key _uri)
199199
200- getLastBuildKeys :: Session ( Either ResponseError [T. Text ])
200+ getLastBuildKeys :: Session [T. Text ]
201201getLastBuildKeys = callTestPlugin GetLastBuildKeys
202202
203- getInterfaceFilesDir :: TextDocumentIdentifier -> Session ( Either ResponseError FilePath )
203+ getInterfaceFilesDir :: TextDocumentIdentifier -> Session FilePath
204204getInterfaceFilesDir TextDocumentIdentifier {_uri} = callTestPlugin (GetInterfaceFilesDir _uri)
205205
206206garbageCollectDirtyKeys :: CheckParents -> Int -> Session [String ]
0 commit comments