2 Replies Latest reply on Jun 7, 2011 2:33 PM by blazejewicz

    Prevent HTTP errors from popping up

    broconne

      I am using HTTP to pull back some optional data in a flex application.  I created the HTTP connection by using the Connect to HTTP from the Data menu.  Sometimes the service is available, sometimes it is not.  Sometimes the data is well formed, sometiems it is not.  I essentially want to "swallow" all of these errors and not have them turn into a modal error dialog or a stack trace when the service isn't available or returns malformed XML.  Is there a way to prevent the default behavior of presenting those errors to the user?

       

       

       

      Thanks.

        • 1. Re: Prevent HTTP errors from popping up
          UbuntuPenguin Level 4

          I don't think errors pop up unless you have a fault handler that results in a popup and the user is using the debug flash player.  But I'm not too sure about it.

          • 2. Re: Prevent HTTP errors from popping up
            blazejewicz Level 4

            Hi,

            @broconne

            if you used built-in service call generation (data management -> generate service call) then you could have something like below lines in your code:

             

            <s:CallResponder id="Operation1Result"/>

                      <myservice:MyService id="myService"

                                                fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"

                                                showBusyCursor="true"/>

            By default Flash Builder inserts fault handler wired to Alert to show you what went wrong. If you have generated code similar to above you could read that docs page that details what code is generated, with description of individual object responsibilities and on how to modify that code to fit your specific requirements:

            http://help.adobe.com/en_US/Flex/4.0/AccessingData/WSbde04e3d3e6474c4-56c6d6d11210238e6e8- 8000.html

            (yes, in you case do not handle fault event with alert, you could simply handle it during debugging phase only - but some error handling is required when providing to end-users I think),

             

            regards,

            Peter