@@ -344,13 +344,13 @@ kill them reason = do
344 else sendCtrlMsg (Just nid) (Kill them reason)
344 else sendCtrlMsg (Just nid) (Kill them reason)
346-- | Thrown by 'kill'
346-- | Thrown by 'kill'
347−newtype ProcessKillException =
347+data ProcessKillException =
348− ProcessKillException String
348+ ProcessKillException !ProcessId !String
349 deriving (Typeable)
349 deriving (Typeable)
351instance Exception ProcessKillException
351instance Exception ProcessKillException
352instance Show ProcessKillException where
352instance Show ProcessKillException where
353− show (ProcessKillException reason) = reason
353+ show (ProcessKillException pid reason) = "Kill by " ++ show pid ++ " : " ++ reason
356-- | Graceful request to exit a process
356-- | Graceful request to exit a process
@@ -372,18 +372,18 @@ data ProcessExitException =
373instance Exception ProcessExitException
373instance Exception ProcessExitException
374instance Show ProcessExitException where
374instance Show ProcessExitException where
375− show (ProcessExitException _ reason) = show reason
375+ show (ProcessExitException pid _) = "Exit by " ++ show pid
377-- | Catches ProcessExitException
377-- | 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
379catchExit act exitHandler = catch act handleExit
379catchExit act exitHandler = catch act handleExit
381 handleExit ex@(ProcessExitException from msg) =
381 handleExit ex@(ProcessExitException from msg) =
382 if messageFingerprint msg == fingerprint (undefined :: a)
382 if messageFingerprint msg == fingerprint (undefined :: a)
384 let reason = decoded
384 let reason = decoded
385− exitHandler from reason
385+ _ <- exitHandler from reason
386− liftIO . throwIO $ ProcessKillException (show reason)
386+ liftIO $ throwIO ex
387 else liftIO $ throwIO ex
387 else liftIO $ throwIO ex
389 decoded :: a
389 decoded :: a