-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add support onError action/event in server side code #359
Comments
You can catch and handle server errors using a try {
// Use DataSourceLoader
} catch(Exception x) {
// handle the error
} |
I use it in this way: |
Now I understand that you need to catch exceptions that occur during the delayed enumeration of the result. Possible solutions: 1. Force JSON serializationtry {
var loadResult = DataSourceLoader.Load(source, loadOptions);
return Content(JsonConvert.SerializeObject(loadResult), "application/json");
} catch(Exception x) {
// TODO
throw;
} 2. Force enumeration (feature request #347)try {
var loadResult = DataSourceLoader.Load(source, loadOptions);
if(loadResult.data is IQueryable)
loadResult.data = loadResult.data.Cast<Object>().ToArray();
return loadResult;
} catch(Exception x) {
// TODO
throw;
} |
Thank you for your help. I implemented the executing of the Queryable. In my case I could not execute the query in all cases, because the "IsCountQuery"-request throws an exception. So in future, it would be nice to have a possiblity to add a logger function. |
Thank you. I updated the code snippets. Now they handle |
There is no action/event to handle errors in a custom way at server side.
There is a property "Log" (in Devart.Data.Linq.DataContext) for logging statements etc. but nothing which is fired in error case.
The text was updated successfully, but these errors were encountered: