Adds in Error without ex for just a message and a message template with params

This commit is contained in:
Warren
2018-08-23 14:43:38 +01:00
parent fb4b0ceb69
commit 24f91f1917
8 changed files with 85 additions and 13 deletions

View File

@@ -227,9 +227,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
if (string.IsNullOrWhiteSpace(entity.Alias))
{
var e = new Exception($"ContentType '{entity.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.");
Logger.Error<ContentTypeRepository>(e, "ContentType '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", entity.Name);
throw e;
var ex = new Exception($"ContentType '{entity.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.");
Logger.Error<ContentTypeRepository>("ContentType '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", entity.Name);
throw ex;
}
((ContentType)entity).AddingEntity();

View File

@@ -521,13 +521,12 @@ AND umbracoNode.id <> @id",
{
if (string.IsNullOrWhiteSpace(pt.Alias))
{
var e = new InvalidOperationException($"Property Type '{pt.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.");
var ex = new InvalidOperationException($"Property Type '{pt.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.");
Logger.Error<ContentTypeRepositoryBase<TEntity>>(e,
"Property Type '{PropertyTypeName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.",
Logger.Error<ContentTypeRepositoryBase<TEntity>>("Property Type '{PropertyTypeName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.",
pt.Name);
throw e;
throw ex;
}
}
@@ -537,7 +536,7 @@ AND umbracoNode.id <> @id",
{
var ex = new InvalidOperationException($"{typeof(TEntity).Name} '{entity.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.");
Logger.Error<ContentTypeRepositoryBase<TEntity>>(ex, "{EntityTypeName} '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.",
Logger.Error<ContentTypeRepositoryBase<TEntity>>("{EntityTypeName} '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.",
typeof(TEntity).Name,
entity.Name);