ASP.Net MVC4 HandleError not rendering view specified

I have one controller Action that has a very different view than the rest of my application and I want any exceptions thrown by that Action to show a different error page than the rest of my app.

I have modified the HandleError attribute but it is NOT loading the error page at all when an exception occurs.

[HttpPost]
[HandleError(View = "UPI_Error", ExceptionType = typeof(ArgumentException))]
public ActionResult ParticipantUpdateSuccess(Participant part)
{
    // Copy the new stuff into the original ParticipantInfo before updating essentially "merging"
    Participant OrigPart = CopyParticipant(part);
    try
    {
        string result = mps.ParticipantUpdate(LogonTicket, ParticipantID, OrigPart);
        if (result != "Update Success")
        {
            throw new ArgumentException(result);
        }
    }
    catch (Exception e)
    {
        throw new ArgumentException(e.Message);
    }
    return View();
}

But, it STILL doesn’t load the UPI_Error page. The ParticipantUpdate call throws this exception:

System.ServiceModel.FaultException`1 was unhandled by user code
  HResult=-2146233087
  Message=ORA-12899: value too large for column "CLI"."CLI_MAIN_ZIP" (actual: 21, maximum: 11)

In the article at this link: http://www.c-sharpcorner.com/UploadFile/ff2f08/exception-or-error-handling-in-Asp-Net-mvc-using-handleerror/

It says that HandleError is not able to catch an exception raised outside of controllers. Since the exception occurs in my web service and is propagated to my application, could that be part of the problem?

But I am throwing a new exception when I catch the one from the web service and it still shows the YSOD vs. my custom error page.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.