git.iko.soy/distributed-process
on master help sign in
Show error when spawn fails
commit8c9a470f221dfc21cebb4f52a1d84ff57fdf5ff3 authorEdsko de Vries <edsko@edsko.net> dateWed 15 Aug 2012, 11:28 (14 years ago) parent0c1f384
1 file changed+4−4
distributed-process/src/Control/Distributed/Process.hs+4−4
distributed-process/src/Control/Distributed/Process.hs+4−4
@@ -296,14 +296,14 @@ spawn nid proc = do
296296 `seqCP` proc
297297 mPid <- receiveWait
298298 [ matchIf (\(DidSpawn ref _) -> ref == sRef)
299− (\(DidSpawn _ pid) -> return $ Just pid)
299+ (\(DidSpawn _ pid) -> return $ Right pid)
300300 , matchIf (\(NodeMonitorNotification ref _ _) -> ref == mRef)
301− (\_ -> return Nothing)
301+ (\(NodeMonitorNotification _ _ err) -> return $ Left err)
302302 ]
303303 unmonitor mRef
304304 case mPid of
305− Nothing -> fail "spawn: remote node failed"
306− Just pid -> send pid () >> return pid
305+ Left err -> fail $ "spawn: remote node failed: " ++ show err
306+ Right pid -> send pid () >> return pid
307307
308308-- | Spawn a process and link to it
309309--