Hi I have my mvc app and this code snippet:
protected override void OnException(ExceptionContext filterContext)
{
base.OnException(filterContext);
ActionInvoker.InvokeAction(filterContext, "ErrorMessage");
}
public ActionResult ErrorMessage(ExceptionContext filterContext)
{
ViewModel<Exception> viewModel = ViewModelFactory.CreateFor(filterContext.Exception);
return View(viewModel);
}
The problem is that I can’t pass arguments to method. I thought it would be this filterContext but in ErrorMessage method it has all default values.
So my question is – How to pass some values to method that I invoke?
I don’t know if it was clear from my question but what I wanted achive was that I didn’t wanted to catch any exception in my controllers actions and still get good-looking message about error. So my solution which satisfies me is: