Exemplo n.º 1
0
    private void ReportError(IExecutionTask task, IError error)
    {
        if (task is null)
        {
            throw new ArgumentNullException(nameof(task));
        }

        if (error is null)
        {
            throw new ArgumentNullException(nameof(error));
        }

        AssertInitialized();

        if (error is AggregateError aggregateError)
        {
            foreach (IError?innerError in aggregateError.Errors)
            {
                ReportSingle(innerError);
            }
        }
        else
        {
            ReportSingle(error);
        }

        void ReportSingle(IError singleError)
        {
            AddProcessedError(ErrorHandler.Handle(singleError));
        }

        void AddProcessedError(IError processed)
        {
            if (processed is AggregateError ar)
            {
                foreach (IError?ie in ar.Errors)
                {
                    Result.AddError(ie);
                    DiagnosticEvents.TaskError(task, ie);
                }
            }
            else
            {
                Result.AddError(processed);
                DiagnosticEvents.TaskError(task, processed);
            }
        }
    }
        private void ReportError(IExecutionTask task, IError error)
        {
            if (task is null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            if (error is null)
            {
                throw new ArgumentNullException(nameof(error));
            }

            AssertInitialized();
            error = ErrorHandler.Handle(error);
            Result.AddError(error);
            DiagnosticEvents.TaskError(task, error);
        }
Exemplo n.º 3
0
 private void ReportError(IExecutionTask task, IError error)
 {
     error = ErrorHandler.Handle(error);
     Result.AddError(error);
     DiagnosticEvents.TaskError(task, error);
 }