Core.Attempt - refactor and cleanup
This commit is contained in:
@@ -67,19 +67,19 @@ namespace Umbraco.Core.Persistence.Mappers
|
||||
|
||||
if (mapper == null)
|
||||
{
|
||||
return Attempt<BaseMapper>.False;
|
||||
return Attempt<BaseMapper>.Fail();
|
||||
}
|
||||
try
|
||||
{
|
||||
var instance = Activator.CreateInstance(mapper) as BaseMapper;
|
||||
return instance != null
|
||||
? new Attempt<BaseMapper>(true, instance)
|
||||
: Attempt<BaseMapper>.False;
|
||||
? Attempt<BaseMapper>.Succ(instance)
|
||||
: Attempt<BaseMapper>.Fail();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error(typeof(MappingResolver), "Could not instantiate mapper of type " + mapper, ex);
|
||||
return new Attempt<BaseMapper>(ex);
|
||||
return Attempt<BaseMapper>.Fail(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user