I am learning exception handling in ASP.NET MVC, what I am trying to achieve is single custom error page that displays error with exception details which of course may varies depending, where is generated from. I not sure if on right track to start with! however I have C# code that read the SQL Stored procedure and return values, I want to add code-level exception handing i.e. try, catch and finally but want to display error on custom error page. How can I achieve this ??
public List<GetAllFunction_SP_Map> GetAllFunction_From_StoreProcedure()
{
List<GetAllFunction_SP_Map> query;
using (var dbContext = new FunctionContext())
{
query = dbContext.Database.SqlQuery<GetAllFunction_SP_Map>("exec GetAllFunction").ToList();
}
return query;
}