Using ASP.NET MVC 5 and the Xero.API.SDK.2.2.1.13.
I'm trying to handle all possible errors thrown when calling the Xero Api. I'm attempting this through over riding the OnException action within my BaseController. This successfully catches all errors thrown but I am unable to access the list of ValidationErrors which appears to be contained within the filterContext object (see below) when I'm debugging. I'm also unable to create a XeroApi.ValidationException object from the filterContext object.
Does anyone know how to access the ValidationErrors in this instance? Or have a more suitable way of handling all xero and other related errors within a single controller?
protected override void OnException(ExceptionContext filterContext)
{
//Below line results in error: "cannot convert System.Exception to
ValidationException. An Explicit conversion exists".
ValidationException ex = filterContext.Exception;
Exception ex = filterContext.Exception;
filterContext.ExceptionHandled = true;
}