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