title: Exception Handling with Expression lambda
body: <p>My DAL doesn't handle exceptions and it will be propagated up to the calling method in the presenter classes where the exception will be handled. </p>
  
  <p>I'm using a single handler called <code>ExecutAction(Action action)</code> so I'm catching exceptions in one place rather than repeating in every method.</p>
  
  <p>At the moment, I'm not logging errors. Just alert the user for an action and try to keep the system alive if possible.</p>
  
  <p>When showing messages to users, Presenters will use a static class called <code>MessagingService</code>. (<code>ShowErrorMessage()</code>). So that I can customize all massage boxes in one place.</p>
  
  <pre><code>        private void Search()
          {
              ExecutAction(() =&gt;
              {
                  var info = _DataService.GetByACNo(_model.AccountNumber);
  
                      if (info != null)
                      {
                          _Model = info ;
                          this.SetViewPropertiesFromModel(_Model, _View);
                      }
                      else
                      {
                          MessageBox.Show ("Bank account not found");
                      }
                  });
              }
  
  
              private void ExecutAction(Action action)
              {
                  try
                  {
                      action();
                  }
  
                  catch (NullReferenceException e) { MessagingService.ShowErrorMessage(e.Message); }
                  catch (System.Data.SqlTypes.SqlTypeException e) { MessagingService.ShowErrorMessage(e.Message); }
                  catch (System.Data.SqlClient.SqlException e) { MessagingService.ShowErrorMessage(e.Message); }
              }
          }
  </code></pre>
  
  <p>Should I include general exception handler to this, to be able to handle any unforeseen exceptions?</p>
  
  <p>Also could you show me a better way to handle showing messages than using a static?</p>
  
  <p>Does use of lambda statements in every method call (<code>ExecutAction(() =&gt;</code>) degrade code readability? </p>
  
  <p>When showing user messages how to show a custom message like "Check the server connection" etc. first and then if the user wants more information (like StackTrace / technical details) he /she could press a button like <code>More Info</code> which is in the MessageBox dialog?</p>