// Token: 0x06001600 RID: 5632 RVA: 0x000521DA File Offset: 0x000503DA
 public override bool WriteError(TaskErrorInfo input, out TaskErrorInfo output)
 {
     if (input != null && input.Exception != null)
     {
         CmdletStaticDataWithUniqueId <Exception> .Set(this.context.UniqueId, input.Exception);
     }
     return(base.WriteError(input, out output));
 }
示例#2
0
        internal static void SetCmdletErrorType(Guid cmdletUniqueId, string errorType)
        {
            string a = CmdletStaticDataWithUniqueId <string> .Get(cmdletUniqueId);

            if (a == "UnHandled")
            {
                return;
            }
            CmdletStaticDataWithUniqueId <string> .Set(cmdletUniqueId, errorType);

            CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ErrorType, errorType);
        }
        // Token: 0x06001606 RID: 5638 RVA: 0x000522DC File Offset: 0x000504DC
        private void OnError(object sender, GenericEventArg <TaskErrorEventArg> genericEventArg)
        {
            if (genericEventArg.Data.ExceptionHandled)
            {
                return;
            }
            Exception exception = genericEventArg.Data.Exception;
            Guid      uniqueId  = this.context.UniqueId;
            Exception ex        = CmdletStaticDataWithUniqueId <Exception> .Get(uniqueId);

            if (ex != null && ex != exception)
            {
                CmdletLogger.SafeAppendGenericError(uniqueId, this.context.Stage.ToString() + ".FromWriteError", ex.ToString(), false);
            }
            bool isUnhandledException = (genericEventArg.Data.IsUnknownException != null) ? genericEventArg.Data.IsUnknownException.Value : TaskHelper.IsTaskUnhandledException(exception);

            CmdletLogger.SafeAppendGenericError(uniqueId, this.context.Stage.ToString(), exception.ToString(), isUnhandledException);
            if (exception is LocalizedException)
            {
                CmdletLogger.SafeAppendGenericError(uniqueId, "ExceptionStringId", ((LocalizedException)exception).LocalizedString.StringId, false);
                if (CmdletLogHelper.NeedConvertLogMessageToUS)
                {
                    LocalizedException ex2            = (LocalizedException)exception;
                    IFormatProvider    formatProvider = ex2.FormatProvider;
                    try
                    {
                        ex2.FormatProvider = CmdletLogHelper.DefaultLoggingCulture;
                        CmdletLogger.SafeAppendGenericError(uniqueId, this.context.Stage.ToString() + "(en-us)", ex2.ToString(), false);
                    }
                    finally
                    {
                        ex2.FormatProvider = formatProvider;
                    }
                }
            }
        }
示例#4
0
        internal static void ClearCmdletErrorType(Guid cmdletUniuqueId)
        {
            CmdletStaticDataWithUniqueId <string> .Remove(cmdletUniuqueId);

            CmdletLogger.SafeSetLogger(cmdletUniuqueId, RpsCmdletMetadata.ErrorType, string.Empty);
        }