Skip to content

Commit 6c31689

Browse files
committed
clean message when module control does not support mvc pipeline
1 parent 473a4d4 commit 6c31689

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

DNN Platform/DotNetNuke.Web.MvcPipeline/Containers/SkinHelpers.Content.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ public static IHtmlString Content(this HtmlHelper<ContainerModel> htmlHelper)
5757
var moduleDiv = new TagBuilder("div");
5858
moduleDiv.AddCssClass(model.ModuleHost.CssClass);
5959
// render module control
60-
moduleDiv.InnerHtml += htmlHelper.Control(model.ModuleConfiguration);
60+
try
61+
{
62+
moduleDiv.InnerHtml += htmlHelper.Control(model.ModuleConfiguration);
63+
}
64+
catch (Exception ex)
65+
{
66+
if (model.EditMode)
67+
{
68+
moduleDiv.InnerHtml += "<div class=\"dnnFormMessage dnnFormError\"> Error loading module: " + ex.Message + "</div>";
69+
}
70+
}
6171
moduleContentPaneDiv.InnerHtml += moduleDiv.ToString();
6272
if (!string.IsNullOrEmpty(model.Footer))
6373
{

DNN Platform/DotNetNuke.Web.MvcPipeline/Utils/MvcUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static IMvcModuleControl GetModuleControl(ModuleInfo module, string contr
105105
}
106106
else
107107
{
108-
throw new Exception("The module control dous not support MVC pipeline : " + module.ModuleTitle + " / " + module.ModuleControl.ControlTitle);
108+
throw new Exception("The module control dous not support the MVC pipeline : " + module.ModuleTitle + " " + module.ModuleControl.ControlTitle);
109109
}
110110
}
111111
control.ModuleContext.Configuration = module;

DNN Platform/DotNetNuke.Web.MvcWebsite/Controls/ModuleActionsControl.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ namespace DotNetNuke.Web.MvcWebsite.Controls
1616
using DotNetNuke.Entities.Tabs;
1717
using DotNetNuke.Framework;
1818
using DotNetNuke.Framework.JavaScriptLibraries;
19+
using DotNetNuke.Instrumentation;
1920
using DotNetNuke.Security;
2021
using DotNetNuke.Security.Permissions;
22+
using DotNetNuke.Services.Installer.Log;
2123
using DotNetNuke.Services.Localization;
2224
using DotNetNuke.Services.Personalization;
2325

@@ -30,6 +32,7 @@ namespace DotNetNuke.Web.MvcWebsite.Controls
3032

3133
public class ModuleActionsControl : RazorModuleControlBase, IResourcable
3234
{
35+
private ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleActionsControl));
3336
private readonly List<int> validIDs = new List<int>();
3437
private ModuleAction actionRoot;
3538

@@ -192,13 +195,19 @@ protected void OnLoad(ModuleInfo moduleInfo)
192195
// base.OnLoad(e);
193196

194197
var moduleActions = new ModuleActionCollection();
198+
try
199+
{
200+
var moduleControl = MvcUtils.CreateModuleControl(moduleInfo);
195201

196-
var moduleControl = MvcUtils.CreateModuleControl(moduleInfo);
197-
198-
var actionable = moduleControl as IActionable;
199-
if (actionable != null)
202+
var actionable = moduleControl as IActionable;
203+
if (actionable != null)
204+
{
205+
moduleActions = actionable.ModuleActions;
206+
}
207+
}
208+
catch (Exception ex)
200209
{
201-
moduleActions = actionable.ModuleActions;
210+
Logger.Error("Error loading module actions for module " + moduleInfo.ModuleID, ex);
202211
}
203212

204213
this.ActionRoot.Actions.AddRange(this.Actions);

0 commit comments

Comments
 (0)