Got to the error in the event handler. Just to wrap this up, here is
the code for those interested:

<mx:HTTPService
id="simpleService"
url="http://example.com/someservice/";
useProxy="false"
method="GET"
fault="onServiceError(event)">

and here is the event handler for the fault:

       import mx.rpc.events.FaultEvent;
       private function onServiceError(event:FaultEvent):void {
            trace("<<<<< service error: ");
            trace(event.fault.faultString);
            trace("<<<<< error detail: ");
            trace(event.fault.faultDetail);            
       }

Thanks again,
Dan

--- In flexcoders@yahoogroups.com, "Clint Tredway" <[EMAIL PROTECTED]> wrote:
>
> yes, a faultEvent is passed which has the info in it. I dont have
the exact
> syntax at the moment.
> 
> On 2/7/07, dantmcgowan <[EMAIL PROTECTED]> wrote:
> >
> >   Peter, Clint,
> > Thanks. One last question: so in the event handler do I have any
> > access to the exception that was raised (for trace purposes)?
> > Dan
> >
> > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
"Peter
> > Farland" <pfarland@> wrote:
> > >
> > > Right, the requests made by HTTPService are asynchronous... so
you have
> > > to wait for events to be dispatched some time later. Any errors that
> > > occur prior to actually sending the request are typically caught and
> > > dispatched as fault events too so there shouldn't be a need for a
> > > try/catch.
> > >
> > >
> > >
> > > ________________________________
> > >
> > > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
[mailto:
> > flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] On
> > > Behalf Of Clint Tredway
> > > Sent: Wednesday, February 07, 2007 2:37 PM
> > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > Subject: Re: [flexcoders] basic exception handling
> > >
> > >
> > >
> > > there is a fault attribute of the HTTPService tag that you can
set to a
> > > function. that will catch any faults from the call.
> > >
> > >
> > > On 2/7/07, dantmcgowan < dan.mcgowan@
> > > <mailto:dan.mcgowan@> > wrote:
> > >
> > > All,
> > > When I am catching exceptions the catch seems to be ignored and
> > > the
> > > actionscript error window pops up. For example if I have a
> > > simple
> > > service like this:
> > >
> > > <mx:HTTPService
> > > id="simpleService"
> > > url="http://example.com/someservice/
> > > <http://example.com/someservice/> "
> > > useProxy="false"
> > > method="GET">
> > >
> > > And I have a try catch block like this with one statement
> > > inside. If I
> > > comment out this statement no errors...so I know this statement
> > > is
> > > causing the error:
> > >
> > > try {
> > > simpleService.send();
> > > }
> > > catch(errObject:Error) {
> > > trace("<Error> "+errObject.message);
> > > }
> > >
> > > The scenarios that throw errors (for example TypeError: Error
> > > #1034)
> > > opens the actionscript error window and the trace does not
> > > appear.
> > > What do I need to be doing so the exception is consumed in the
> > > catch
> > > and no error window? Thanks,
> > >
> > > Dan
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > http://indeegrumpee.spaces.live.com/
> > > <http://indeegrumpee.spaces.live.com/>
> > >
> >
> >  
> >
> 
> 
> 
> -- 
> http://indeegrumpee.spaces.live.com/
>

Reply via email to