Select to view content in your preferred language

Fault error at site start up. 2.4 Sample viewer

1540
8
01-01-2012 06:13 AM
ChristinaMcCullough
Regular Contributor
Does anyone know how to eliminate the fault pop up error at start up when a data service is not available?  Previous versions of the Sample viewer did not do this.
Tags (2)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
Christina,

   There is NO configuration setting that you can change to prevent that error message from appearing. If you have the ability to change the Viewers source code and recompile than you can prevent its appearance.

In the MapManager.mxml find the function layer_loadErrorEvent and comment out the following line:

AppEvent.showError(errorMessage, MAP_MANAGER);


Also you need to post Flex Viewer (no longer Flex Sample Viewer) questions to the Flex Viewer forum.

http://forums.arcgis.com/forums/111-ArcGIS-Viewer-for-Flex
0 Kudos
ChristinaMcCullough
Regular Contributor
This is the code I see from line 828 to 835, Viewer 2.4.  Shall I comment out AppEvent.showError(errorMessage);?

private function layer_loadErrorEvent(event:LayerEvent):void
            {
                event.layer.removeEventListener(LayerEvent.LOAD_ERROR, layer_loadErrorEvent);
                event.layer.removeEventListener(LayerEvent.LOAD, layer_loadEvent);

                var errorMessage:String = event.layer.name + " layer failed to load: " + makeHTMLSafe(buildFaultMessage(event.fault));
                AppEvent.showError(errorMessage);
            }

Thank you this is a big help.
0 Kudos
ChristinaMcCullough
Regular Contributor
I commented out the line '//AppEvent.showError(errorMessage);' and is appears to be working correctly.  thank you.  I would have not figured it out myself. 


private function layer_loadErrorEvent(event:LayerEvent):void
{
event.layer.removeEventListener(LayerEvent.LOAD_ERROR, layer_loadErrorEvent);
event.layer.removeEventListener(LayerEvent.LOAD, layer_loadEvent);

var errorMessage:String = event.layer.name + " layer failed to load: " + makeHTMLSafe(buildFaultMessage(event.fault));
//AppEvent.showError(errorMessage);
}
0 Kudos
ChristinaMcCullough
Regular Contributor
I thought it was working, but I was wrong.  I looked everywhere in the code for the following text, function layer_loadErrorEvent.  Stuck...
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Christina,

  The
            private function layer_loadErrorEvent(event:LayerEvent):void
            {
                event.layer.removeEventListener(LayerEvent.LOAD_ERROR, layer_loadErrorEvent);
                event.layer.removeEventListener(LayerEvent.LOAD, layer_loadEvent);

                var errorMessage:String = event.layer.name + " layer failed to load: " + makeHTMLSafe(buildFaultMessage(event.fault));
                //AppEvent.showError(errorMessage);
            }
Should be the right function in 2.4 and commenting out  the show error line should do it... What is your error that you are seeing now with that line commented out?
0 Kudos
ChristinaMcCullough
Regular Contributor
This is the error I receive.  the error pops up about 1 minute after opening.  I need no error warnings to show as this site will be posted within a webpage that has ~6 other sites visible at the same time.  The viewer is within a portlet.  The viewer needs to be maintenance free once it is in production. 

As data providers will always have an issue with services, this could be an issue.  Any suggestions are welcome.

thank you for your help.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Christina,

   I searched all through the project and that is the only spot that uses the show error with the text "layer failed to load"...

You may need to try and run a "clean" from the project menu, also try commenting out the line indicated below as well:

            private function layer_loadErrorEvent(event:LayerEvent):void
            {
                event.layer.removeEventListener(LayerEvent.LOAD_ERROR, layer_loadErrorEvent);
                event.layer.removeEventListener(LayerEvent.LOAD, layer_loadEvent);

                //var errorMessage:String = event.layer.name + " layer failed to load: " + makeHTMLSafe(buildFaultMessage(event.fault));
                //AppEvent.showError(errorMessage);
            }


Short of that there is no logical reason you should still see that error. To see what I mean just search for "AppEvent.showError" in the whole project.
0 Kudos
ChristinaMcCullough
Regular Contributor
Commenting out both lines seems to have worked.  I will let you know if anything changes.

Thank you so much
Christina
0 Kudos