DataSource#requestEnd has no error information

7 posts, 0 answers
  1. Miguel
    Miguel avatar
    15 posts
    Member since:
    Jul 2014

    Posted 02 Dec 2014 Link to this post

    I was handling the requestEnd event of the DataSource, but it doesn't contain information about errors: 
    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#events-requestEnd

    Is it possible to add error information to the event parameter? similar to what we have on http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#events-error


  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 04 Dec 2014 Link to this post

    Hello Miguel,

    The requestEnd event will be fired when there were no errors and the request has been completed successfully. This is why no error information is available in this event and cannot be added. You can use the error event for handling failed requests.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Miguel
    Miguel avatar
    15 posts
    Member since:
    Jul 2014

    Posted 04 Dec 2014 in reply to Kiril Nikolov Link to this post

    That's not the behavior I'm seeing. requestEnd is called when an error occurs, from within the error callback, right before triggering the error event (handy to have the sources BTW). Right from where we trigger requestEnd, we have all the error information available. On success, the requestEnd is trigger from a different place, where there's obviously no error information. 

    I think it makes sense for "requestEnd" to be fired even for errors, since, well, the request ended regardless of success/error. However, we need a way to distinguish them. 
    Also, it would be nice to have a success event that will be triggered only on success the way you expected requestEnd to work. 
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 05 Dec 2014 Link to this post

    Hello Miguel,

    Please accept my apologies - the requestEnd event will be fired even if there is an error with the request, just to notify that the request is completed. The error event is the one that will give you more information about the request status and information about the error. If you want to include the error information inside the requestEnd event, you can modify the following code and include the xhr object:

    https://github.com/telerik/kendo-ui-core/blob/master/src/kendo.data.js#L3004

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Miguel
    Miguel avatar
    15 posts
    Member since:
    Jul 2014

    Posted 05 Dec 2014 in reply to Kiril Nikolov Link to this post

    Yes that's what I meant. I just send a Pull Request for that change. I think that's better than just modifying the source code since we're actually getting the kendo.data that's shipping with kendo-ui-pro and it will be simpler to manage instead of getting different sources from different places. 
  7. Christophe
    Christophe avatar
    1 posts
    Member since:
    Feb 2015

    Posted 14 Apr 2015 Link to this post

    Hello,

    I need check a header of the http response during the requestend in order to know if it is my application that is responding to the request or if the SSO server has rejected the request (session timeout with http code 200 / login page).

    Have you planned to give more informations for this event? 

    How can I get the headers? What I need to modify in source v2015.1.318? I found the line

    that.trigger(REQUESTEND, { response: response, type: type }); but the xhr object seems to be far in the stack call.

     

  8. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 15 Apr 2015 Link to this post

    Hello Christophe,

     

    Currently we do not have plans on including this information in the requestEnd event. You can submit this as a feature request on UserVoice, so that it is considered for implementation in a future release.

     

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready