From 28652815ae0e7f09db4da6779e2b6fa83f703921 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Sun, 19 Jun 2011 07:27:47 -0200 Subject: [PATCH] Improved the error message for a KeyNotFound exception in datatype factory --- umbraco/cms/businesslogic/datatype/factory.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/umbraco/cms/businesslogic/datatype/factory.cs b/umbraco/cms/businesslogic/datatype/factory.cs index 4c0dfb0234..8633e2d62f 100644 --- a/umbraco/cms/businesslogic/datatype/factory.cs +++ b/umbraco/cms/businesslogic/datatype/factory.cs @@ -51,8 +51,15 @@ namespace umbraco.cms.businesslogic.datatype.controls { throw new ArgumentException("DataEditorId is empty. This usually means that no data editor was defined for the data type. To correct this update the entry in the cmsDataType table to ensure it matches a Guid from an installed data editor."); } - IDataType newObject = Activator.CreateInstance(_controls[DataEditorId]) as IDataType; + if (_controls.ContainsKey(DataEditorId)) + { + IDataType newObject = Activator.CreateInstance(_controls[DataEditorId]) as IDataType; return newObject; + } + else + { + throw new ArgumentException("Could not find a IDataType control matching DataEditorId " + DataEditorId.ToString() + " in the controls collection. To correct this, check the data type definition in the settings section or ensure that the package/control is installed correctly."); + } } ///