Esempio n. 1
0
        public void Run()
        {
            while (true)
            {
                var input = Console.ReadLine();
                if (input == "End")
                {
                    Console.WriteLine(animalCentre.GetOwnersInfo());
                    return;
                }

                try
                {
                    Console.WriteLine(commandInterpreter.ExecuteCommand(input));
                }
                catch (Exception ex)
                {
                    if (ex.InnerException == null)
                    {
                        Console.WriteLine($"{ex.GetType().Name}: {ex.Message}");
                    }
                    else
                    {
                        Console.WriteLine($"{ex.InnerException.GetType().Name}: {ex.InnerException.Message}");
                    }
                }
            }
        }