Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Exception add for Junction::sendMessage();  (Read 8197 times)
Sebastian
Newbie
*
Posts: 2


View Profile WWW Email
« 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
« Last Edit: October 25, 2008, 10:22:31 by Sebastian » Logged

puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
Pages: [1]
Print