title: Should I use exceptions to handle user input validation?
body: <p>I'm in the process of moving my business logic code from my controllers to business classes.  My page requires a lot of user input validation.  This created many nesting levels in my code.   So I re-wrote the code in my business layer to look like this:</p>
  
  <pre><code>    public RmaDetail SerialNumberScan(int rmaNumber, int serialNumber, RepairInvoice repairInvoice) {
      var result = SelectRmaDetail(rmaNumber, serialNumber);
  
      if (result != null) throw new BusinessException("Serial Number not found.");
  
      if (result.Received != 1) throw new BusinessException("Line item has not been received.");
  
      bool? workOrderClosed = WorkOrderClosed(result.LNSEQNBR, result.LNSEQNBR, serialNumber);
  
      if (!workOrderClosed.HasValue) throw new BusinessException("Work order not found.");
  
      if (workOrderClosed.Value == false) throw new BusinessException("Work order not closed.");
  
      repairInvoice.TerminalType = result.ITEMNMBR.Trim();
      repairInvoice.UnderWarranty = RepairInvoiceDataLayer.UnderWarranty(result.RETDOCID, result.LNSEQNBR, serialNumber, result.CUSTNMBR);
  
      return result;
  }
  </code></pre>
  
  <p>And here is my controller:</p>
  
  <pre><code>    public ActionResult SerialNumberScan(string rmaNumber, string serialNumber)
  {
      if (ModelState.IsValid)
      {
          ModelState["SerialNumber"].Value = new ValueProviderResult(serialNumber, serialNumber, CultureInfo.CurrentCulture);
          try
          {
              var rmaDetail = BusinessLayer.SerialNumberScan(rmaNumber, serialNumber, repairInvoice);
              Session["RmaDetail"] = rmaDetail;
              ViewBag.SetFocusTo = "#RepairLevels";
          }
          catch (BusinessException ex)
          {
              ViewBag.AlertMessage = ex.Message;
          }
      }
  
      return View("Index", repairInvoice);
  }
  </code></pre>
  
  <p>The line <code>ViewBag.AlertMessage</code> is a message that displays at the top of my page.  I like this approach because it is very readable.  However, I know that exceptions are very expensive.  Is there a better approach? </p>