예제 #1
0
        public int Divide(int num1, int num2)
        {
            CustomFaultDetails ex = new CustomFaultDetails("Dividing by 0 is forbidden");

            if (num2 == 0)
            {
                throw new FaultException <CustomFaultDetails>(ex, new FaultReason(ex.Message));
            }
            return(num1 / num2);
        }
예제 #2
0
 public int Divide(int num1, int num2)
 {
     if (num2 == 0)
     {
         CustomFaultDetails ex = new CustomFaultDetails();
         ex.ErrorID      = "12345";
         ex.ErrorDetails = "Specific error details here.";
         throw new FaultException <CustomFaultDetails>(ex, "Reason: Testing");
     }
     return(num1 / num2);
 }
예제 #3
0
 public int Divide(int num1, int num2)
 {
     if (num2 == 0)
     {
         CustomFaultDetails ex = new CustomFaultDetails();
         ex.ErrorID      = "12345";
         ex.ErrorDetails = "Divide by zero";
         throw new FaultException <CustomFaultDetails>(ex, "Exception occurred at service level");
     }
     return(num1 / num2);
 }
 public double Divide(int num1, int num2)
 {
     if (num2 == 0)
     {
         CustomFaultDetails fault = new CustomFaultDetails();
         fault.Message = "Exception occurred at service level : Divide by zero";
         throw new FaultException <CustomFaultDetails>(fault);
     }
     else
     {
         return((double)num1 / (double)num2);
     }
 }
예제 #5
0
 public float Divide(float num1, float num2)
 {
     if (num2 == 0)
     {
         CustomFaultDetails ex = new CustomFaultDetails
         {
             ErrorId      = "12345",
             ErrorDetails = "Cannot divide by 0"
         };
         throw new FaultException <CustomFaultDetails>(ex, "Cannot divide by 0");
     }
     return(num1 / num2);
 }