DataSource "error" event is not firing

7 posts, 0 answers
  1. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 26 Feb 2015 Link to this post

    Hi,

    I am hooking into the error event to handle errors returned from server.

    The server currently sends to client, in case of errors, something like this:
    {"errors":[{"id":"b128083a-4027-431b-a04b-7485530e347a","errorMessage":"Account failed to update"}]}

    As for the Data Source configuration:
    schema: { errors: "errors" }
    error: function(e) {console.log(e.errors);}

    However, the error event doesn't fire.
    Is there something I am missing?

    Regards
    Bilal
  2. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 26 Feb 2015 in reply to Bilal Link to this post

    This is now the exception I am getting:

  3. Kendo UI is VS 2017 Ready
  4. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 26 Feb 2015 in reply to Bilal Link to this post


    2015-02-27 00:20:28.445VM214:3 Uncaught TypeError: Cannot read property 'errors' of undefined     VM214:3
    (anonymous function)kendo.all.min.js:11
    ht.extend._handleCustomErrorskendo.all.min.js:11
    ht.extend._acceptkendo.all.min.js:11
    (anonymous function)jquery.min.js:3
    (anonymous function)jquery.min.js:3
    cjquery.min.js:3 p.fireWithjquery.min.js:3 b.each.i.(anonymous function)kendo.all.min.js:11 e.Deferred.r.transport.(anonymous function).call.tt.successjquery.min.js:3 cjquery.min.js:3 p.fireWithjquery.min.js:5 kjquery.min.js:5 send.r
  5. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 27 Feb 2015 in reply to Bilal Link to this post

    I noticed in the "Preview" tab of Chrome, the response is shown as:


    Seems "errors" are wrapped inside an object and DataSource not seeing the "errors" property!

  6. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 27 Feb 2015 in reply to Bilal Link to this post

    Please find attached image.
  7. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 27 Feb 2015 in reply to Bilal Link to this post

    More debugging from inside Parse function:
  8. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 27 Feb 2015 in reply to Bilal Link to this post

    This issue has been resolved. 
    I debugged my application using kendo.web.js file and I noticed that in my case, I am implementing "Parse" function and in my return values I am hiding errors, so now this is fixed and I am returning the errors in case they exist.

    Best regards
    Bilal Haidar
Back to Top
Kendo UI is VS 2017 Ready