public ErrorResponse CreateErrorResponse() { ErrorResponse returnValue = new ErrorResponse(); Exception ex = _exceptionHandler.Error; if (ex as AggregateException != null) { AggregateException aggregateException = ex as AggregateException; returnValue.AddErrors(ProcessAggregateException(aggregateException)); } if (ex as ApiCallFailedException != null) { ApiCallFailedException apiCallFailedException = ex as ApiCallFailedException; returnValue.AddError(ProcessApiCallFailedException(apiCallFailedException)); } returnValue.AddError(_httpContext.TraceIdentifier, 500, ex.Message); return(returnValue); }