// 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; } } } }