The catch clause catch (InvalidOperationException e) should propagate IOException (via Console.WriteLine) and not be affected by
catch (IOException e) { } - not be silenced.
try
{
Console.Write("Write number: ");
var number = Console.ReadLine();
if (number is null)
{
throw new InvalidOperationException("Argument is null");
}
var parsedNumber = Process(number);
Console.WriteLine($"The number was: {parsedNumber}");
}
catch (IOException e) { }
catch (OutOfMemoryException e) { }
catch (ArgumentOutOfRangeException e) { }
catch (InvalidOperationException e)
{
Console.WriteLine(e.Message);
}
Related to #14 - Probably the same
In this case, where it was detected;
The catch clause
catch (InvalidOperationException e)
should propagateIOException
(viaConsole.WriteLine
) and not be affected bycatch (IOException e) { }
- not be silenced.