[flexcoders] basic exception handling
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/; 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
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 [EMAIL PROTECTED] 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/; 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/
RE: [flexcoders] basic exception handling
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 [mailto:[EMAIL PROTECTED] On Behalf Of Clint Tredway Sent: Wednesday, February 07, 2007 2:37 PM To: flexcoders@yahoogroups.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 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 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/