private void HandleBuilderExceptions(HttpResponse response, AuthMetadataBuilderException ex) { if (ex is AuthMetadataInternalException) { this.ReportBuilderException(response, ex, true, HttpStatusCode.InternalServerError, new LocalizedString?(HttpProxyStrings.ErrorInternalServerError)); } }
private void ReportBuilderException(HttpResponse response, AuthMetadataBuilderException ex, bool logCallStack, HttpStatusCode httpStatusCode, LocalizedString?overridingError) { this.Logger.Set(ServiceCommonMetadata.ErrorCode, ex.GetType().Name); string value = logCallStack ? ex.ToString() : ex.Message; this.Logger.AppendGenericError(ex.GetType().Name, value); response.StatusCode = (int)httpStatusCode; response.TrySkipIisCustomErrors = true; LocalizedString?localizedString = new LocalizedString?(overridingError ?? ex.LocalizedString); LocalizedString?localizedString2 = localizedString; this.WriteResponse(response, (localizedString2 != null) ? localizedString2.GetValueOrDefault() : null, true); }