We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Handling Errors

Hello, i need help with the following:

1. How to Handle error when the ASMX webservice doesn't exists anymore cause for example it was moved, name changed
2. How to handle a timeout error.
3. How to handle any error example, webservice could have a error for example division by 0 and not handle it a try catch

At my different test escenarios none of those escenarios runs .done code.

I'm trying to use ej.DataManager with knockoutjs, require, bootstrap :) and with the following code i can call the ASMX webservice and read the data fine as long as there are no communication error.

 var dataManager = ej.DataManager({
                url: "/Datos.asmx/CatalogoIncidente",
                adaptor:new ej.UrlAdaptor(), //"UrlAdaptor",
                crossDomain: false,
                offline: false
            });
            var query = ej.Query();
            query.addParams("userName", "EB_HMACIAS");
            var promise = dataManager.executeQuery(query);
            promise.done(function (e) {
                ko.mapping.fromJSON(e.result, {}, self);
            });

Thanks for response

3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team December 23, 2015 09:31 AM UTC

Hi Hostilio,

Thanks for contacting Syncfusion support.

We can handle the error or any exception in the fail function. The fail function gets invoked when there is any error while making the request or an exception.

For your convenience, we have created a sample and thrown an exception manually in the
 ASMXPage.

Please find the following code example and sample:


<script type="text/javascript">

       

        var dataManager = ej.DataManager({

            url: "/WebService.asmx/Get",

            adaptor: new ej.UrlAdaptor(), //"UrlAdaptor",

            crossDomain: false,

            offline: false

        });

        var data = [];

        var query = ej.Query();

        query.addParams("userName", "EB_HMACIAS");

        var promise = dataManager.executeQuery(query);

        promise.done(function (e) {

            data = e.result.result;

        });

        promise.fail(function (e) {

            alert("Handling errors")

        });     
    </script>  


Sample: http://www.syncfusion.com/downloads/support/forum/121518/ze/KnockoutSample_(2)-918495002

Regards,
Prasanna Kumar N.S.V



HO Hostilio December 23, 2015 02:22 PM UTC

Thank you very much, really thanks.

I'm not a native english speaker but, can you point me to the documentation or example about fail? cause i'm still dunno on how could i miss it!




PK Prasanna Kumar Viswanathan Syncfusion Team December 24, 2015 11:55 AM UTC

Hi Hostilio,

We have created an improvement task for the UG documentation and a support incident has been created under your account to resolve the issue. Please log on to our support website to check for further updates. 


https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Regards,
Prasanna Kumar N.S.V


Loader.
Up arrow icon