private void HandleExceptions(Exception exception) { switch (exception) { case AmbiguousProjectException: case AmbiguousSolutionException: case CyclicReferenceException: case FileReadException: _outputWriter.PrintException(exception); break; case AggregateException aggregateException: aggregateException.InnerExceptions.ForEach(HandleExceptions); break; default: _outputWriter.PrintException(exception); ExceptionDispatchInfo.Capture(exception).Throw(); break; } }