10 Answers, 1 is accepted
Hello Andy,
Could you please elaborate on sharing more details on the case? Namely:
- Is the data source utilizing a type of "signal"?
- Can you share the method implementation from the hub? How does it connect to the data source?
Please note that only if the schema.errors option is set and the server response contains that field, then the error event will be fired.
Looking forward to your reply.
Regards,
Nikolay
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Nikolay,
Thanks very much for the response. Before I share the implementation, I think it might be good for you to familiarize yourself with SignalR. It's a technology that lets the browser use sockets to retrieve and be sent data rather than requiring polling. Here's a link to an implementation of SignalR
https://demos.telerik.com/kendo-ui/grid/signalr
Hello Andy,
As my colleague Nikolay has mentioned in the previous reply, In order to be able to help, we will need more information regarding the exact implementation at your end. It would be very helpful if you could send us an isolated runnable application to replicate the issue so we could be more helpful with a possible solution.
Regards,
Neli
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Neli,
Thanks for the reply. I don't think my question is clear- I don't know how to implement an error property in a signalr data source. I see an example on other data source types, but I don't think those techniques apply to signalr sources. Could you please point me at an example of returning an error message from a signalr data source?
Hi Andy,
I am afraid we do not have an example of returning an error with SignalR dataSource. However, the error event of the DataSource could be used. In case an error is returned from the server, the error event will be triggered. I would suggest you take a look at the forum thread linked below. The thread is regarding UI for ASP.NET Core scenario, but the handing errors with SingalR DataSource is discussed.
- https://www.telerik.com/forums/data-from-signalr-hub-not-visible-in-grid.
Regards,
Neli
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Neli,
Sorry, I'm confused. I understand you don't have an example handy, but it is functionality that Telerik provides if I'm not mistaken? If it is, I don't think it's beyond usual support scope to ask for an example. Am I missing something?
Hi Andy,
I used the SingalR sample projects in the repo linked here to test the dataSource behavior. As explained in my previous reply, when the server throws an error, the dataSource error event will be triggered. So for testing purposes, the following exception was thrown when reading the data :
public IEnumerable<MeetingViewModel> Read(FilterRange range)
{
throw new InvalidOperationException("");
}
Then, the error event handler was triggered. Below is an example of subscribing to the dataSource error event when using Kendo UI for jQuery:
dataSource: {
type: "signalr",
error: function (e) {
.....
console.log(e.xhr)
},
The support service provides an explanation of the built-in functionality of our UI components, their configuration, API methods, and events. We often provide code snippets as guidance for achieving the needed result. Above you could find such an example of how to subscribe to the error event handler when using our components with SignalR dataSource. In case you have additional questions related to the components configuration, please let us know.
Regards,
Neli
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Neli,
Thanks for the reply. It looks like I wasn't clear enough about where I was stuck. I have an error handler and know how to wire it up, and it's hit. The issue is that throwing an exception results in an XHR along these lines:
"An unexpected error occurred invoking 'create' on the server. Exception: [FromDate, This appointment falls outside of working hours]"
So you can see how it'd be a good deal of work to extract out the portion inside the brackets that wasn't previously necessary. Before I upgraded (I'm not sure which version lost this function) I could add an Error property onto the object being returned and that error message was available in the error handler without any parsing. Can you tell me what functionality should replace that? I don't think the intention is for me to parse out the error, so I'm hoping you can provide a better solution?
Sorry to post right back, but I've solved my issue. I was looking for this:
https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/schema#schemaerrors
I'd removed the mapping of the errors property of the schema to my property named Error, so I was no longer triggering the error datasource method by setting that Error property. Hope this helps someone else, and sorry I couldn't explain it well enough for you to know what I was after. Thanks for the effort anyway!
Hello Andy,
I am glad that you have managed to resolve the issue by yourself. Thank you very much for sharing more information about the issue and the working solution. I am sure it will be helpful to the other users in the community.
Regards,
Neli
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.