From your configured error handling action, you could do something like:
public IActionResult Error()
{
// 'Context' here is of type HttpContext
var feature = Context.GetFeature();
if(feature != null)
{
var exception = feature.Error;
}
......
.......