title: Error handling in controllers with MVC
body: <p>Does it make sense to do error handling and logging inside actions methods or handle the OnException method inside the controllers.  One way means writing try/catches in all the action methods even when there is nothing to be done to recover from the error.  Handling this at the controller level would allow logging and redirection to an error handler page without writing try/catches inside all the action methods.  </p>
  
  <p>Which method makes the most sense?  Here is example code of try/catches in an action method.</p>
  
  <pre><code>        [HttpPost]
          public ActionResult Delete(int id)
          {
              using (new Tracer("Project Controller"))
              {
                  try
                  {
                      Logger.Write("Deleting project");
                      projService.DeleteProject(id);
                      TempData["message"] = "Project Deleted successfully";
                  }
                  catch (System.Exception ex)
                  {
                      HandleException(ex, "Project could not be deleted.");
                  }
                  return RedirectToAction("List");
              }
          }
  </code></pre>