Select to view content in your preferred language

Layer onLoad event, how to handle an error in javascript api version 1.2(no on Error)

1346
6
08-01-2011 12:50 PM
AlexanderMena
Deactivated User
Hi, good afternoon.


http://forums.arcgis.com/threads/16516-Layer-onLoad-event-how-to-handle-an-error?highlight=onError

I will like do it but unfortunately I'm working on version 1.2 of the JavaScript API that do not support the event "onError". Someone could work with any idea to get the error when a service does not load?

Note: I can not change the version of the api.

Thank you.
0 Kudos
6 Replies
derekswingley1
Deactivated User
Can you elaborate on why you can't upgrade to a more recent version?
0 Kudos
AlexanderMena
Deactivated User
The client does not allow for the development testing process would be longer.
0 Kudos
derekswingley1
Deactivated User
Implementing your own error handling for layers that fail to load will also increase development and testing time.

I really, really encourage you to upgrade to something newer, at least 1.6, if not 2.4. Also, if you have to work with support, they'll probably ask you to upgrade as well.
0 Kudos
AlexanderMena
Deactivated User
Where can I download the version 1.6 api javascript ?

We are working in copy local of the api 1.2.

Thank you.
0 Kudos
derekswingley1
Deactivated User
The download page is:  http://resources.arcgis.com/content/web/arcgis-javascript-api-download

But that only has 2.0+ releases. Customer support might be able to provide a disc with 1.6 on it. You can also still access 1.6 using this link:  http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6
0 Kudos
AlexanderMena
Deactivated User
I am trying with it:

var deactivateToolBar = false;
        dojo.xhrGet( { //
            // The following URL must match that used to test the server.
            url: services.service.serviceUrl + "?f=json", // la url del servicio a cargar en el mapa.
            handleAs: "json",
            timeout: 20000, // Time in milliseconds

            // The LOAD function will be called on a successful response.

            load: function(response, ioArgs) {
               
                var objList = response;
               
                if (objList&&objList.length>1) {
                 showMessage("servicio disponible");

                }
                //return response;
            },

            // The ERROR function will be called in an error case.
            error: function(response, ioArgs) {
                //console.error("HTTP status code: ", ioArgs.xhr.status);
             //iconToolbar.deactivate();
             deactivateToolBar = true;
                var msg = "Ocurrio un error cargando un servicio, detalle del error: " + response;
                showMessage(msg);
                //return response;
            }
        });

I ordered the customer service a CD with the version 1.6 API.

Thank you.
0 Kudos