Example #1
0
 private void HandleSlaveException(
     Exception exc, SlaveFailMethod method, SlaveFailAction action)
 {
     if (action == SlaveFailAction.Propogate)
     {
         throw exc;
     }
     else if (action == SlaveFailAction.Ignore)
     {
         // Intentionally Empty
     }
     else if (action == SlaveFailAction.Filter)
     {
         FilterException(exc, method);
     }
     else
     {
         Debug.Assert(false, "Unhandled SlaveFailAction");
     }
 }
Example #2
0
 private void HandleSlaveException(
     Exception exc, SlaveFailMethod method, SlaveFailAction action)
 {
     if (action == SlaveFailAction.Propogate)
     {
         throw exc;
     }
     else if (action == SlaveFailAction.Ignore)
     {
         // Intentionally Empty
     }
     else if (action == SlaveFailAction.Filter)
     {
         FilterException(exc, method);
     }
     else
     {
         throw new InvalidOperationException("Unhandled SlaveFailAction.");
     }
 }
Example #3
0
        private void FilterException(Exception exc, SlaveFailMethod method)
        {
            // Allow a user-provided filter function to
            // handle the errors.
            SlaveFailAction action = SlaveFailAction.Filter;

            if (method == SlaveFailMethod.Read)
            {
                action = m_slaveReadFailFilter(this, method, exc);
            }
            else if (method == SlaveFailMethod.Write)
            {
                action = m_slaveWriteFailFilter(this, method, exc);
            }
            else if (method == SlaveFailMethod.Seek)
            {
                action = m_slaveSeekFailFilter(this, method, exc);
            }
            else
            {
                Debug.Assert(false, "Unhandled SlaveFailMethod.");
            }

            if (action == SlaveFailAction.Filter)
            {
                throw new InvalidOperationException(
                          "SlaveFailAction.Filter is not a valid return "
                          + "value for the ReadFailFilter delegate.",
                          exc
                          );
            }

            // Handle the exception in the manner specified by the filter.
            // This will always be an indirect recursive call into
            // HandleSlaveException since this method is always called by
            // HandleSlaveException itself, but this time the action can't
            // possibly be 'Filter' (see above), so there can be no
            // infinite recursion.
            HandleSlaveException(exc, method, action);
        }
Example #4
0
 private void HandleSlaveException(
   Exception exc, SlaveFailMethod method, SlaveFailAction action)
 {
   if (action == SlaveFailAction.Propogate) {
     throw exc;
   }
   else if (action == SlaveFailAction.Ignore) {
     // Intentionally Empty
   }
   else if (action == SlaveFailAction.Filter) {
     FilterException(exc, method);
   }
   else {
     Debug.Assert(false, "Unhandled SlaveFailAction");
   }
 }
Example #5
0
    private void FilterException(Exception exc, SlaveFailMethod method)
    {
      // Allow a user-provided filter function to
      // handle the errors.
      SlaveFailAction action = SlaveFailAction.Filter;

      if (method == SlaveFailMethod.Read)
        action = m_slaveReadFailFilter(this, method, exc);
      else if (method == SlaveFailMethod.Write)
        action = m_slaveWriteFailFilter(this, method, exc);
      else if (method == SlaveFailMethod.Seek)
        action = m_slaveSeekFailFilter(this, method, exc);
      else
        Debug.Assert(false, "Unhandled SlaveFailMethod.");

      if (action == SlaveFailAction.Filter) {
        throw new InvalidOperationException(
          "SlaveFailAction.Filter is not a valid return "
          + "value for the ReadFailFilter delegate.",
          exc
          );
      }

      // Handle the exception in the manner specified by the filter.
      // This will always be an indirect recursive call into
      // HandleSlaveException since this method is always called by
      // HandleSlaveException itself, but this time the action can't
      // possibly be 'Filter' (see above), so there can be no
      // infinite recursion.
      HandleSlaveException(exc, method, action);
    }
Example #6
0
 private void HandleSlaveException(
     Exception exc, SlaveFailMethod method, SlaveFailAction action)
 {
     if (action == SlaveFailAction.Propogate)
       {
     throw exc;
       }
       else if (action == SlaveFailAction.Ignore)
       {
     // Intentionally Empty
       }
       else if (action == SlaveFailAction.Filter)
       {
     FilterException(exc, method);
       }
       else
       {
     throw new InvalidOperationException("Unhandled SlaveFailAction.");
       }
 }