@@ -344,13 +344,13 @@ kill them reason = do
344344 else sendCtrlMsg (Just nid) (Kill them reason)
345345
346346-- | Thrown by 'kill'
347−newtype ProcessKillException =
348− ProcessKillException String
347+data ProcessKillException =
348+ ProcessKillException !ProcessId !String
349349 deriving (Typeable)
350350
351351instance Exception ProcessKillException
352352instance Show ProcessKillException where
353− show (ProcessKillException reason) = reason
353+ show (ProcessKillException pid reason) = "Kill by " ++ show pid ++ " : " ++ reason
354354
355355
356356-- | Graceful request to exit a process
@@ -372,18 +372,18 @@ data ProcessExitException =
372372
373373instance Exception ProcessExitException
374374instance Show ProcessExitException where
375− show (ProcessExitException _ reason) = show reason
375+ show (ProcessExitException pid _) = "Exit by " ++ show pid
376376
377377-- | Catches ProcessExitException
378−catchExit :: forall a b . (Show a, Serializable a) => Process b -> (ProcessId -> a -> Process ()) -> Process b
378+catchExit :: forall a b . (Show a, Serializable a) => Process b -> (ProcessId -> a -> Process b) -> Process b
379379catchExit act exitHandler = catch act handleExit
380380 where
381381 handleExit ex@(ProcessExitException from msg) =
382382 if messageFingerprint msg == fingerprint (undefined :: a)
383383 then do
384384 let reason = decoded
385− exitHandler from reason
386− liftIO . throwIO $ ProcessKillException (show reason)
385+ _ <- exitHandler from reason
386+ liftIO $ throwIO ex
387387 else liftIO $ throwIO ex
388388 where
389389 decoded :: a