git.iko.soy/distributed-process
on master help sign in
revert d225580 (better ProcessExitException show)

It turns out that subtle decoding issues can arise from the given implementation, and the horrors therein far outweigh any benefits of being able to print exit reasons which happen to be a string.

commita057e3e0f554ce2289fc798157fc6b74af8a4306 authorTim Watson <tim@rabbitmq.com> dateTue 22 Jan 2013, 00:58 (14 years ago) parentc804296
2 files changed+3−12
distributed-process/src/Control/Distributed/Process/Internal/Types.hs+2−10 distributed-process/tests/TestCH.hs+1−2
distributed-process/src/Control/Distributed/Process/Internal/Types.hs+2−10
@@ -73,7 +73,7 @@ import System.Mem.Weak (Weak)
7373import Data.Map (Map)
7474import Data.Int (Int32)
7575import Data.Typeable (Typeable)
76−import Data.Binary (Binary(put, get), putWord8, getWord8, encode, decode)
76+import Data.Binary (Binary(put, get), putWord8, getWord8, encode)
7777import qualified Data.ByteString as BSS (ByteString, concat, copy)
7878import qualified Data.ByteString.Lazy as BSL
7979 ( ByteString
@@ -378,15 +378,7 @@ data ProcessExitException =
378378
379379instance Exception ProcessExitException
380380instance Show ProcessExitException where
381− show = showProcessExit
382−
383−showProcessExit :: ProcessExitException -> String
384−showProcessExit (ProcessExitException pid reason) =
385− case messageFingerprint reason == fingerprint (undefined :: String) of
386− True -> "origin=" ++ (show pid) ++ ",reason=" ++ decoded
387− False -> "origin=" ++ show pid
388− where decoded :: String
389− !decoded = decode (messageEncoding reason)
381+ show (ProcessExitException pid _) = "exit-from=" ++ (show pid)
390382
391383instance Exception ProcessLinkException
392384instance Exception NodeLinkException
distributed-process/tests/TestCH.hs+1−2
@@ -1047,8 +1047,7 @@ testPrettyExit transport = do
10471047 _ <- forkProcess localNode $ do
10481048 (die "timeout")
10491049 `catch` \ex@(ProcessExitException from _) ->
1050− let expected = "origin=" ++ (show from) ++
1051− ",reason=timeout"
1050+ let expected = "exit-from=" ++ (show from)
10521051 in do
10531052 True <- return $ (show ex) == expected
10541053 liftIO $ putMVar done ()