using System.Web.Mvc;

namespace Sevomin.WebFrontend.Controllers
{
    public class BaseController : Controller
    {
        protected override void OnException(ExceptionContext filterContext)
        {
            #if DEBUG
            filterContext.ExceptionHandled = false;
            #else
            filterContext.ExceptionHandled = true;
            #endif
            var e = new Elmah.Error(filterContext.Exception);

            Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(e);

            // Redirect
            filterContext.Result = View("Error");
            base.OnException(filterContext);
        }

		public ActionResult Error404()
		{
            return View();
		}
			
    }
}
