Esempio n. 1
0
        //djeli ako je dozvoljeno
        public double DoDivide(double a, double b)
        {
            if (b == 0)
            {
                DivideByZeroException e = new DivideByZeroException("You tried to divide by zero which is not meaningful");
                e.HelpLink = "http://www.libertyassociates.com";
                throw e;
            }
            if (a == 0)
            {
                MyCustomException e = new MyCustomException("Can't have zero divisor");
                e.HelpLink = "http://www.libertyassociates.com/NoZeroDivisor.html";
                throw e;
            }

            return(a / b);
        }
Esempio n. 2
0
            // do the division if legal
            public double DoDivide(double a, double b)
            {
                if (b == 0)
                {
                    DivideByZeroException e = new DivideByZeroException();

                    e.HelpLink = "http://www.libertyassociates.com";
                    throw e;
                }
                if (a == 0)

                {
                    // create a custom exception instance
                    MyCustomException e = new MyCustomException("Can't have zero dividend");
                    e.HelpLink = "http://www.libertyassociates.com/NoZeroDividend.htm"; throw e;
                }
                return(a / b);
            }