@@ -182,25 +182,25 @@ canonicalizeUri uri = filePathToUri <$> canonicalizePath (fromJust (uriToFilePat
182
182
diagnostic :: Session (NotificationMessage TextDocumentPublishDiagnostics )
183
183
diagnostic = LspTest. message STextDocumentPublishDiagnostics
184
184
185
- callTestPlugin :: (A. FromJSON b ) => TestRequest -> Session ( Either ResponseError b )
185
+ callTestPlugin :: (A. FromJSON b ) => TestRequest -> Session b
186
186
callTestPlugin cmd = do
187
187
let cm = SCustomMethod " test"
188
188
waitId <- sendRequest cm (A. toJSON cmd)
189
189
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
195
195
196
- waitForAction :: String -> TextDocumentIdentifier -> Session ( Either ResponseError WaitForIdeRuleResult )
196
+ waitForAction :: String -> TextDocumentIdentifier -> Session WaitForIdeRuleResult
197
197
waitForAction key TextDocumentIdentifier {_uri} =
198
198
callTestPlugin (WaitForIdeRule key _uri)
199
199
200
- getLastBuildKeys :: Session ( Either ResponseError [T. Text ])
200
+ getLastBuildKeys :: Session [T. Text ]
201
201
getLastBuildKeys = callTestPlugin GetLastBuildKeys
202
202
203
- getInterfaceFilesDir :: TextDocumentIdentifier -> Session ( Either ResponseError FilePath )
203
+ getInterfaceFilesDir :: TextDocumentIdentifier -> Session FilePath
204
204
getInterfaceFilesDir TextDocumentIdentifier {_uri} = callTestPlugin (GetInterfaceFilesDir _uri)
205
205
206
206
garbageCollectDirtyKeys :: CheckParents -> Int -> Session [String ]
0 commit comments