git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2582 from kRITZCREEK/psc-ide-small-logging-improvements

[psc-ide] Log failing to accept or parse an incoming command

commit086f6b72e1de15dce4c2dc55f59882261076017c authorChristoph Hegemann <kRITZCREEK@users.noreply.github.com> dateThu 19 Jan 2017, 08:29 (10 years ago) parentd2c4b075192165
1 file changed+4−4
psc-ide-server/Main.hs+4−4
psc-ide-server/Main.hs+4−4
@@ -130,9 +130,9 @@ startServer port env = withSocketsDo $ do
130130 where
131131 loop :: (Ide m, MonadLogger m) => Socket -> m ()
132132 loop sock = do
133− accepted <- runExceptT $ acceptCommand sock
133+ accepted <- runExceptT (acceptCommand sock)
134134 case accepted of
135− Left err -> $(logDebug) err
135+ Left err -> $(logError) err
136136 Right (cmd, h) -> do
137137 case decodeT cmd of
138138 Just cmd' -> do
@@ -147,7 +147,7 @@ startServer port env = withSocketsDo $ do
147147 Right r -> liftIO $ BS8.hPutStrLn h (Aeson.encode r)
148148 Left err -> liftIO $ BS8.hPutStrLn h (Aeson.encode err)
149149 Nothing -> do
150− $(logDebug) ("Parsing the command failed. Command: " <> cmd)
150+ $(logError) ("Parsing the command failed. Command: " <> cmd)
151151 liftIO $ do
152152 T.hPutStrLn h (encodeT (GeneralError "Error parsing Command."))
153153 hFlush stdout
@@ -167,7 +167,7 @@ acceptCommand sock = do
167167 case cmd' of
168168 Nothing -> throwError "Connection was closed before any input arrived"
169169 Just cmd -> do
170− $(logDebug) cmd
170+ $(logDebug) ("Received command: " <> cmd)
171171 pure (cmd, h)
172172 where
173173 acceptConnection = liftIO $ do