This is a migrated thread and some comments may be shown as answers.

DataSource#requestEnd has no error information

6 Answers 401 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Miguel
Top achievements
Rank 1
Miguel asked on 02 Dec 2014, 08:31 PM
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


6 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 04 Dec 2014, 11:47 AM
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!
 
0
Miguel
Top achievements
Rank 1
answered on 04 Dec 2014, 04:10 PM
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. 
0
Kiril Nikolov
Telerik team
answered on 05 Dec 2014, 01:19 PM
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!
 
0
Miguel
Top achievements
Rank 1
answered on 05 Dec 2014, 03:05 PM
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. 
0
Christophe
Top achievements
Rank 1
answered on 14 Apr 2015, 07:56 AM

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.

 

0
Kiril Nikolov
Telerik team
answered on 15 Apr 2015, 09:00 AM

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!
 
Tags
Data Source
Asked by
Miguel
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Miguel
Top achievements
Rank 1
Christophe
Top achievements
Rank 1
Share this question
or