Пример #1
0
        internal static string LocalizeMessage(DomainException ex, IStringLocalizer localizer)
        {
            var value = localizer.GetString(ex.ErrorCode ?? ex.MessageTemplate ?? ex.GetType().Name);

            if (value.ResourceNotFound)
            {
                return(ex.MessageParams?.Any() == true?string.Format(ex.MessageTemplate, ex.MessageParams) : ex.MessageTemplate ?? ex.GetType().Name);
            }
            return(ex.MessageParams?.Any() == true?string.Format(value.Value, ex.MessageParams) : value.Value);
        }
 private static void AddExceptionInfoToProblemDetails(ProblemDetails problemDetails, DomainException exception)
 {
     problemDetails.Title = exception.Message;
     problemDetails.Type  = exception.GetType().Name;
 }