From b7a8f5f581276fa2b51f216c605fb8f8c0b6009d Mon Sep 17 00:00:00 2001 From: Kevin Giszewski Date: Fri, 2 May 2014 09:20:59 -0400 Subject: [PATCH 1/3] Add try/catch with logging to prop converters --- .../ArcheTypePropertyEditor.cs | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/app/Umbraco/Umbraco.Archetype/PropertyEditors/ArcheTypePropertyEditor.cs b/app/Umbraco/Umbraco.Archetype/PropertyEditors/ArcheTypePropertyEditor.cs index e55ed1d..3192130 100644 --- a/app/Umbraco/Umbraco.Archetype/PropertyEditors/ArcheTypePropertyEditor.cs +++ b/app/Umbraco/Umbraco.Archetype/PropertyEditors/ArcheTypePropertyEditor.cs @@ -11,6 +11,7 @@ using Umbraco.Core.Models.Editors; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; using Umbraco.Web.PropertyEditors; +using Umbraco.Core.Logging; namespace Archetype.Umbraco.PropertyEditors { @@ -64,11 +65,18 @@ namespace Archetype.Umbraco.PropertyEditors { foreach (var propDef in fieldset.Properties) { - var dtd = dataTypeService.GetDataTypeDefinitionById(Guid.Parse(propDef.DataTypeGuid)); - var propType = new PropertyType(dtd) { Alias = propDef.Alias }; - var prop = new Property(propType, propDef.Value); - var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); - propDef.Value = propEditor.ValueEditor.ConvertDbToString(prop, propType, dataTypeService); + try + { + var dtd = dataTypeService.GetDataTypeDefinitionById(Guid.Parse(propDef.DataTypeGuid)); + var propType = new PropertyType(dtd) { Alias = propDef.Alias }; + var prop = new Property(propType, propDef.Value); + var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); + propDef.Value = propEditor.ValueEditor.ConvertDbToString(prop, propType, dataTypeService); + } + catch (Exception ex) + { + LogHelper.Error(ex.Message, ex); + } } } @@ -86,11 +94,18 @@ namespace Archetype.Umbraco.PropertyEditors { foreach (var propDef in fieldset.Properties) { - var dtd = dataTypeService.GetDataTypeDefinitionById(Guid.Parse(propDef.DataTypeGuid)); - var propType = new PropertyType(dtd) { Alias = propDef.Alias }; - var prop = new Property(propType, propDef.Value); - var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); - propDef.Value = propEditor.ValueEditor.ConvertDbToEditor(prop, propType, dataTypeService); + try + { + var dtd = dataTypeService.GetDataTypeDefinitionById(Guid.Parse(propDef.DataTypeGuid)); + var propType = new PropertyType(dtd) { Alias = propDef.Alias }; + var prop = new Property(propType, propDef.Value); + var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); + propDef.Value = propEditor.ValueEditor.ConvertDbToEditor(prop, propType, dataTypeService); + } + catch (Exception ex) + { + LogHelper.Error(ex.Message, ex); + } } } @@ -107,11 +122,18 @@ namespace Archetype.Umbraco.PropertyEditors { foreach (var propDef in fieldset.Properties) { - var dtd = ApplicationContext.Current.Services.DataTypeService.GetDataTypeDefinitionById(Guid.Parse(propDef.DataTypeGuid)); - var preValues = ApplicationContext.Current.Services.DataTypeService.GetPreValuesCollectionByDataTypeId(dtd.Id); - var propData = new ContentPropertyData(propDef.Value, preValues, new Dictionary()); - var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); - propDef.Value = propEditor.ValueEditor.ConvertEditorToDb(propData, propDef.Value); + try + { + var dtd = ApplicationContext.Current.Services.DataTypeService.GetDataTypeDefinitionById(Guid.Parse(propDef.DataTypeGuid)); + var preValues = ApplicationContext.Current.Services.DataTypeService.GetPreValuesCollectionByDataTypeId(dtd.Id); + var propData = new ContentPropertyData(propDef.Value, preValues, new Dictionary()); + var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); + propDef.Value = propEditor.ValueEditor.ConvertEditorToDb(propData, propDef.Value); + } + catch (Exception ex) + { + LogHelper.Error(ex.Message, ex); + } } } From 432a33eef8e0e331fb4ef038c07856de7640a4d4 Mon Sep 17 00:00:00 2001 From: Tom Fulton Date: Sat, 3 May 2014 00:32:18 -0600 Subject: [PATCH 2/3] Add `package` task that creates both packages to simplify CI Duplicated task steps to prevent needing to build multiple times but maintaining 'full build' in the individual package tasks --- Gruntfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8bbb3d9..6bacbeb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -208,6 +208,7 @@ module.exports = function(grunt) { grunt.registerTask('default', ['clean', 'less', 'concat', 'assemblyinfo', 'msbuild:dist', 'copy:dll', 'copy:config', 'copy:html']); - grunt.registerTask('nuget', ['clean:tmp', 'default', 'copy:nuget', 'template:nuspec', 'nugetpack', 'clean:tmp']); + grunt.registerTask('nuget', ['clean:tmp', 'default', 'copy:nuget', 'template:nuspec', 'nugetpack', 'clean:tmp']); grunt.registerTask('umbraco', ['clean:tmp', 'default', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']); + grunt.registerTask('package', ['clean:tmp', 'default', 'copy:nuget', 'template:nuspec', 'nugetpack', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']); }; \ No newline at end of file From 688ad534f2887093072e5fbc09f8198d1a831e41 Mon Sep 17 00:00:00 2001 From: Kevin Giszewski Date: Tue, 6 May 2014 13:00:05 -0400 Subject: [PATCH 3/3] Check for config for label template --- app/controllers/controller.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/controller.js b/app/controllers/controller.js index 3f31ac3..61ab521 100644 --- a/app/controllers/controller.js +++ b/app/controllers/controller.js @@ -15,6 +15,8 @@ //helper to get $eval the labelTemplate $scope.getFieldsetTitle = function(fieldsetConfigModel, fieldsetIndex) { + if(!fieldsetConfigModel) + return ""; var fieldset = $scope.model.value.fieldsets[fieldsetIndex]; var fieldsetConfig = $scope.getConfigFieldsetByAlias(fieldset.alias); var template = fieldsetConfigModel.labelTemplate;