Skip to content

Commit c857168

Browse files
committed
Missed opportunity to use logAndReturnError
1 parent 7f45bd0 commit c857168

File tree

1 file changed

+2
-5
lines changed
  • ghcide/src/Development/IDE/Plugin

1 file changed

+2
-5
lines changed

ghcide/src/Development/IDE/Plugin/HLS.hs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ failedToParseArgs :: CommandId -- ^ command that failed to parse
7777
failedToParseArgs (CommandId com) (PluginId pid) err arg = "Error while parsing args for " <> com <> " in plugin " <> pid <> ": " <> T.pack err <> "\narg = " <> T.pack (show arg)
7878

7979
-- | Build a ResponseError and log it before returning to the caller
80-
logAndReturnError :: Recorder (WithPriority Log) -> ErrorCode -> Text -> LSP.LspT Config IO (Either ResponseError J.Value)
80+
logAndReturnError :: Recorder (WithPriority Log) -> ErrorCode -> Text -> LSP.LspT Config IO (Either ResponseError a)
8181
logAndReturnError recorder errCode msg = do
8282
let err = ResponseError errCode msg Nothing
8383
logWith recorder Warning $ LogPluginError err
@@ -192,10 +192,7 @@ extensiblePlugins recorder xs = mempty { P.pluginHandlers = handlers }
192192
let fs = filter (\(pid,_) -> pluginEnabled m pid config) fs'
193193
-- Clients generally don't display ResponseErrors so instead we log any that we come across
194194
case nonEmpty fs of
195-
Nothing -> do
196-
let err = ResponseError InvalidRequest (pluginNotEnabled m) Nothing
197-
logWith recorder Info $ LogPluginError err
198-
pure $ Left err
195+
Nothing -> logAndReturnError recorder InvalidRequest (pluginNotEnabled m)
199196
Just fs -> do
200197
let msg e pid = "Exception in plugin " <> T.pack (show pid) <> "while processing " <> T.pack (show m) <> ": " <> T.pack (show e)
201198
es <- runConcurrently msg (show m) fs ide params

0 commit comments

Comments
 (0)