private static void DeployRover(Canvas canvas) { var rover = new Rover(canvas); var roverDropSuccess = false; do { Console.WriteLine(); Console.WriteLine("Enter Rover's drop off point."); try { string dropPosition = Console.ReadLine(); rover.DropAt(dropPosition); roverDropSuccess = true; } catch (MyCustomException ex) { Console.WriteLine(); Console.WriteLine(ex.Message); Console.WriteLine("Please try again to drop your Rover."); } catch (Exception ex) { Console.WriteLine("!! Exception !!"); } }while (!roverDropSuccess); Console.WriteLine(); Console.WriteLine("Enter Rover's path to explore."); var roverExploreSuccess = false; do { try { string explorationPath = Console.ReadLine(); rover.Explore(explorationPath); Console.WriteLine(); Console.WriteLine(string.Format("Rover Position - {0}", rover.Position.ToString())); roverExploreSuccess = true; } catch (OutOfBoundException ex) { Console.WriteLine(); Console.WriteLine("Ooops !! Rover went too far from the Canvas. It is on the ledge"); Console.WriteLine(string.Format("Rover Position - {0}", rover.Position.ToString())); roverExploreSuccess = true; } catch (MyCustomException ex) { Console.WriteLine(ex.Message); Console.WriteLine("Rover couldn't explore. Try again."); } catch (Exception ex) { Console.WriteLine("!! Exception !!"); } }while (!roverExploreSuccess); }