Ejemplo n.º 1
0
        public void RunLogic3()
        {
            string dataToParse = "";

            while (String.IsNullOrWhiteSpace(dataToParse)) // cannot get ArgumentNullException if string is not empty
            {
                try
                {
                    Console.WriteLine("Enter 'string' type data");
                    dataToParse = StringParser();
                }
                catch (ScubaException ex)
                {
                    Console.WriteLine($"Sorry, student {ex.studentNumber}, You got a ScubaException: {ex.Message}");
                }
            }
            try
            {
                Logics.Logic3(dataToParse);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
            catch (FormatException ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
            catch (OverflowException ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
        }
Ejemplo n.º 2
0
        public void RunLogic3()
        {
            string data;

            try
            {
                TryReadStringParser(out data);
                try
                {
                    Logics.Logic3(data);
                }
                catch (OverflowException e)
                {
                    Console.WriteLine(e.Message.ToString());
                }
            }
            catch (ScubaException e)
            {
                Console.WriteLine(String.Format("Hey {0}, You have an exception as ScubaException : {1}", e.StudentNum, e.Message));
            }
        }