using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CatchThrow
{
class Program
{
static string str;
static int retries = 1;
static void Main(string[] args)
{
int attempt = 1;
bool success = false;
try
{
do
{
try
{
Print();
success = true;
}
catch (FormatException f)
{
Console.WriteLine(" Exception, {0} retries remaining - {1}", retries + 1 - attempt, f.Message);
if (attempt++ > retries)
throw f;
}
} while (!success);
}
catch (FormatException z)
{
Console.WriteLine("WOW");
}
Console.ReadLine();
}
static void Print()
{
str = Console.ReadLine();
if (str.Contains('a'))
throw new FormatException("aaaaaaaaaaaaa");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CatchThrow
{
class Program
{
static string str;
static int retries = 1;
static void Main(string[] args)
{
int attempt = 1;
bool success = false;
try
{
do
{
try
{
Print();
success = true;
}
catch (FormatException f)
{
Console.WriteLine(" Exception, {0} retries remaining - {1}", retries + 1 - attempt, f.Message);
if (attempt++ > retries)
throw f;
}
} while (!success);
}
catch (FormatException z)
{
Console.WriteLine("WOW");
}
Console.ReadLine();
}
static void Print()
{
str = Console.ReadLine();
if (str.Contains('a'))
throw new FormatException("aaaaaaaaaaaaa");
}
}
}