#17284: Exceptions should log errors

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2011-02-08 11:22:47 -08:00
parent 406ab0e71a
commit a8a48ab4e1
15 changed files with 199 additions and 167 deletions

View File

@@ -1,13 +1,14 @@
using System;
using System.Linq;
using System.Web.Mvc;
using Orchard.Environment;
using Orchard.Environment.Configuration;
using Orchard.Localization;
using Orchard.Logging;
using Orchard.MultiTenancy.Services;
using Orchard.MultiTenancy.ViewModels;
using Orchard.Security;
using Orchard.UI.Notify;
using Orchard.Utility.Extensions;
namespace Orchard.MultiTenancy.Controllers {
[ValidateInput(false)]
@@ -21,10 +22,12 @@ namespace Orchard.MultiTenancy.Controllers {
Services = orchardServices;
T = NullLocalizer.Instance;
Logger = NullLogger.Instance;
}
public Localizer T { get; set; }
public IOrchardServices Services { get; set; }
public ILogger Logger { get; set; }
public ActionResult Index() {
return View(new TenantsIndexViewModel { TenantSettings = _tenantService.GetTenants() });
@@ -61,9 +64,9 @@ namespace Orchard.MultiTenancy.Controllers {
});
return RedirectToAction("Index");
}
catch (Exception exception) {
Services.Notifier.Error(T("Creating Tenant failed: {0}", exception.Message));
} catch (Exception exception) {
this.Error(exception, T("Creating Tenant failed: {0}", exception.Message), Logger, Services.Notifier);
return View(viewModel);
}
}
@@ -115,9 +118,9 @@ namespace Orchard.MultiTenancy.Controllers {
});
return RedirectToAction("Index");
}
catch (Exception exception) {
Services.Notifier.Error(T("Failed to edit tenant: {0} ", exception.Message));
} catch (Exception exception) {
this.Error(exception, T("Failed to edit tenant: {0} ", exception.Message), Logger, Services.Notifier);
return View(viewModel);
}
}