public static void MyFunction(MyErrorClass err)
{
var query = from filter in DataContext.ErrorFilters select filter;
query = query.Where(f => err.ErrorMessage.Contains(f.ErrorMessage));
List<ErrorFilter> filters = query.ToList();
}
So, I have some problems with the above code, and I get an error message from the subject line in the line query.ToList(). Here is what I am trying to do:
Firstly, I have my own kind of errors MyErrorClass. Whenever an error occurs on my site, I create an object MyErrorClassfrom the exception, save all the data from the exception in this object and save the information in the database.
One of the properties of the exception I'm tracking is the error message ( ErrorMessage). I have a table ErrorFiltersconfigured in a database where the user can filter errors based on ErrorMessage. Therefore, say that you get a lot of errors that say: "System.Data.SqlClient.SqlException: timed out. The timeout period expires before the operation completes or the server does not respond." And you want to ignore them. You simply add a filter to the database with ErrorMessage as "timeout expired" and set it to ignore.
Now my class above is set to accept the error and decides whether to filter the error. I am trying to get a list of all filters that have an ErrorMessageerror.
I am sure this is a simple solution, I just don’t know how to fix it.
Steven