protected override IEnumerable <TOutputMsg> ProcessInner(IEnumerable <TInputMsg> inputMsgs, out bool hasErrors)
        {
            TOutputMsg errorResult = default(TOutputMsg);

            try
            {
                return(base.ProcessInner(inputMsgs, out hasErrors));
            }
            catch (DataflowNetworkUnrecoverableErrorException ex)
            {
                LogAgent.LogFatal(TaskType, InnerTask.Name, ex);

                //Now cancel the network
                Network.CancelNetwork();

                errorResult = CreateErrorOutputMessage(ex);
            }
            catch (DataflowNetworkRecoverableErrorException ex)
            {
                LogAgent.LogUnknown(TaskType, InnerTask.Name, ex);

                errorResult = CreateErrorOutputMessage(ex);
            }
            catch (Exception ex)
            {
                errorResult = CreateErrorOutputMessage(ex);
            }

            hasErrors = true;

            return(new[] { errorResult });
        }
        protected override IEnumerable <TOutputMsg> DecorateOutputMessages(IEnumerable <TOutputMsg> outputMsgs)
        {
            if (outputMsgs == null)
            {
                yield break;
            }

            TOutputMsg errorResult = default(TOutputMsg);
            var        e           = outputMsgs.GetEnumerator();

            while (true)
            {
                try
                {
                    if (!e.MoveNext())
                    {
                        yield break;
                    }
                }
                catch (DataflowNetworkUnrecoverableErrorException ex)
                {
                    LogAgent.LogFatal(TaskType, InnerTask.Name, ex);

                    //Now cancel the network
                    Network.CancelNetwork();

                    errorResult = CreateErrorOutputMessage(ex);
                }
                catch (DataflowNetworkRecoverableErrorException ex)
                {
                    LogAgent.LogUnknown(TaskType, InnerTask.Name, ex);

                    errorResult = CreateErrorOutputMessage(ex);
                }
                catch (Exception ex)
                {
                    errorResult = CreateErrorOutputMessage(ex);
                }

                if (errorResult != null)
                {
                    yield return(errorResult);
                }

                var current = e.Current;
                yield return(current);
            }
        }