Skip to content

Commit 02e5f7c

Browse files
committed
Kill the printing of "Handling" to stderr
The `"Handling " <> show e` message would get printed to the stderr of the dap server. This resulted in thinking something was wrong in inumerous occasions, seeing messages such as: ``` [stderr] DAP.Se [stderr] rver/Handling: [stderr] ghc-internal:GHC.Internal.IO.Exception [stderr] .IOException: <socket: 13>: Da [stderr] ta.ByteString.hGetLine: end of file IPE backtrac [stderr] e: [stderr] DAP.Server [stderr] .getHeaderHandle (src/DAP/Server.hs:(217,1)-(220,32)) HasCallStack backtrace: ioException, called at [stderr] libraries/ghc-internal/src/GHC/Internal/IO/H [stderr] andle/Internals.hs:353:11 in ghc- [stderr] internal:GHC.Internal.IO.Handle.Interna [stderr] ls ``` (I had slightly tweaked the message to investigate what was going wrong) When, in reality, nothing was wrong. This was an EOF exception indicating the client had closed the connection. However, when looking at the logs, the "Handling" was misleading (and not easily correlated with the "Client has ended its connection below". All in all, I don't think we should print the "Handling" at all. If an exception is handled, it is handled. If it is not, then it gets logged to the appropriate logger as "Unknown Exception".
1 parent ec2f815 commit 02e5f7c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/DAP/Server.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import Network.Simple.TCP ( serve, HostPreference(Host) )
4646
import Network.Socket ( socketToHandle, withSocketsDo, SockAddr )
4747
import System.IO ( hClose, hSetNewlineMode, Handle, Newline(CRLF)
4848
, NewlineMode(NewlineMode, outputNL, inputNL)
49-
, IOMode(ReadWriteMode), stderr, hPrint)
49+
, IOMode(ReadWriteMode) )
5050
import System.IO.Error ( isEOFError )
5151
import System.Exit ( exitWith, ExitCode(ExitSuccess) )
5252
import Text.Read ( readMaybe )
@@ -176,7 +176,6 @@ exceptionHandler logAction handle address shouldLog serverThread (e :: SomeExcep
176176
= logger logAction ERROR address Nothing
177177
$ withBraces
178178
$ T.pack ("Unknown Exception: " <> show e)
179-
hPrint stderr ("Handling" <> show e)
180179
when shouldLog $ do
181180
dumpError
182181
logger logAction INFO address (Just SENT) (withBraces "Closing Connection")

0 commit comments

Comments
 (0)