PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: Sebastian on October 24, 2008, 07:02:34



Title: Exception add for Junction::sendMessage();
Post by: Sebastian on October 24, 2008, 07:02:34
it would be good if the method sendMessage would throw an exception - as done by addPipeListener

org.puremvc.as3.multicore.utilities.pipes.plumbing.Junction

public function sendMessage( outputPipeName:String, message:IPipeMessage ):Boolean
{
   var success:Boolean=false;
   if ( hasOutputPipe(outputPipeName) )
   {
      var pipe:IPipeFitting = pipesMap[outputPipeName] as IPipeFitting;
      success = pipe.write(message);
   }
   if(!success)
      throw("Unable to send message to output pipe listener on " + outputPipeName);

   return success;
}

Regards,
Sebastian


Title: Re: Exception add for Junction::sendMessage();
Post by: puremvc on October 28, 2008, 06:57:48
That is a pretty drastic action that forces every single sendMessage call to have to be surrounded by a try/catch.

That's why a boolean is returned. If you are concerned about whether a message is sent check this value.

The reason for this is that if a module wants to take itself offline, all it needs to do is remove the pipe listener for that pipe inside its JunctionMediator   subclass. Senders should not get an error or have to be recoded for this scenario by adding try/catch blocks.

-=Cliff>