2 Replies Latest reply on May 10, 2010 2:39 AM by megharajdeepak

    How to handle fault event using Cairngorm?

    megharajdeepak Level 1


      I have started using Cairgorm framework recently. But in this, I'm not able to figure out a place to handle a fault event. Based on some tutorial, here's my Command code:


      public class LoginCommand implements ICommand, IResponder{
              public var model:ViewModelLocator = ViewModelLocator.getInstance();
              public function LoginCommand(){


              public function execute(event:CairngormEvent):void{
                  var loginEvent:LoginEvent = event as LoginEvent;
                  var delegate:LoginDelegate = new LoginDelegate(this);   
                  model.userName = loginEvent.loginAttempt.userName;
                  model.password = loginEvent.loginAttempt.password;
              public function result(data:Object):void{
                  model.applicationState = model.constants.MAIN_SCREEN;
                  model.acCarbonFootPrint = data.result.EtCarbonFootPrint;
                  model.acVariants = data.result.EtVariant;
                  model.acBuildings = data.result.EtBuilding;
                  model.cbLabelField = model.constants.FIELD_DESC_NAME;
              public function fault(info:Object):void{
                  var faultEvent:FaultEvent = FaultEvent(info);


                  Alert.show("Some fault...");


      If the return from the webservice is successful, it get's into result function. But if there is something wrong(like URL is offline), it wont get inside the fault function. Instead I get a runtime error. Here' a screen shot which depicts the dispatch of fault event from WebService.as:



      Is there some other place\function where I can catch this fault event?