Example #1
0
 public ErrorRecord(ErrorRecord errorRecord, System.Exception replaceParentContainsErrorRecordException)
 {
     this.pipelineIterationInfo = new ReadOnlyCollection <int>(new int[0]);
     if (errorRecord == null)
     {
         throw new PSArgumentNullException("errorRecord");
     }
     if ((replaceParentContainsErrorRecordException != null) && (errorRecord.Exception is ParentContainsErrorRecordException))
     {
         this._error = replaceParentContainsErrorRecordException;
     }
     else
     {
         this._error = errorRecord.Exception;
     }
     this._target             = errorRecord.TargetObject;
     this._errorId            = errorRecord._errorId;
     this._category           = errorRecord._category;
     this._activityOverride   = errorRecord._activityOverride;
     this._reasonOverride     = errorRecord._reasonOverride;
     this._targetNameOverride = errorRecord._targetNameOverride;
     this._targetTypeOverride = errorRecord._targetTypeOverride;
     if (errorRecord.ErrorDetails != null)
     {
         this._errorDetails = new System.Management.Automation.ErrorDetails(errorRecord.ErrorDetails);
     }
     this.SetInvocationInfo(errorRecord._invocationInfo);
     this._scriptStackTrace = errorRecord._scriptStackTrace;
     this._serializedFullyQualifiedErrorId = errorRecord._serializedFullyQualifiedErrorId;
 }
Example #2
0
 public ErrorRecord(ErrorRecord errorRecord, System.Exception replaceParentContainsErrorRecordException)
 {
     this.pipelineIterationInfo = new ReadOnlyCollection<int>(new int[0]);
     if (errorRecord == null)
     {
         throw new PSArgumentNullException("errorRecord");
     }
     if ((replaceParentContainsErrorRecordException != null) && (errorRecord.Exception is ParentContainsErrorRecordException))
     {
         this._error = replaceParentContainsErrorRecordException;
     }
     else
     {
         this._error = errorRecord.Exception;
     }
     this._target = errorRecord.TargetObject;
     this._errorId = errorRecord._errorId;
     this._category = errorRecord._category;
     this._activityOverride = errorRecord._activityOverride;
     this._reasonOverride = errorRecord._reasonOverride;
     this._targetNameOverride = errorRecord._targetNameOverride;
     this._targetTypeOverride = errorRecord._targetTypeOverride;
     if (errorRecord.ErrorDetails != null)
     {
         this._errorDetails = new System.Management.Automation.ErrorDetails(errorRecord.ErrorDetails);
     }
     this.SetInvocationInfo(errorRecord._invocationInfo);
     this._scriptStackTrace = errorRecord._scriptStackTrace;
     this._serializedFullyQualifiedErrorId = errorRecord._serializedFullyQualifiedErrorId;
 }
Example #3
0
 private void PopulateProperties(System.Exception exception, object targetObject, string fullyQualifiedErrorId, ErrorCategory errorCategory, string errorCategory_Activity, string errorCategory_Reason, string errorCategory_TargetName, string errorCategory_TargetType, string errorCategory_Message, string errorDetails_Message, string errorDetails_RecommendedAction)
 {
     if (exception == null)
     {
         throw PSTraceSource.NewArgumentNullException("exception");
     }
     if (fullyQualifiedErrorId == null)
     {
         throw PSTraceSource.NewArgumentNullException("fullyQualifiedErrorId");
     }
     this._isSerialized = true;
     this._error        = exception;
     this._target       = targetObject;
     this._serializedFullyQualifiedErrorId = fullyQualifiedErrorId;
     this._category           = errorCategory;
     this._activityOverride   = errorCategory_Activity;
     this._reasonOverride     = errorCategory_Reason;
     this._targetNameOverride = errorCategory_TargetName;
     this._targetTypeOverride = errorCategory_TargetType;
     this._serializedErrorCategoryMessageOverride = errorCategory_Message;
     if (errorDetails_Message != null)
     {
         this._errorDetails = new System.Management.Automation.ErrorDetails(errorDetails_Message);
         if (errorDetails_RecommendedAction != null)
         {
             this._errorDetails.RecommendedAction = errorDetails_RecommendedAction;
         }
     }
 }
Example #4
0
 private void PopulateProperties(System.Exception exception, object targetObject, string fullyQualifiedErrorId, ErrorCategory errorCategory, string errorCategory_Activity, string errorCategory_Reason, string errorCategory_TargetName, string errorCategory_TargetType, string errorCategory_Message, string errorDetails_Message, string errorDetails_RecommendedAction)
 {
     if (exception == null)
     {
         throw PSTraceSource.NewArgumentNullException("exception");
     }
     if (fullyQualifiedErrorId == null)
     {
         throw PSTraceSource.NewArgumentNullException("fullyQualifiedErrorId");
     }
     this._isSerialized = true;
     this._error = exception;
     this._target = targetObject;
     this._serializedFullyQualifiedErrorId = fullyQualifiedErrorId;
     this._category = errorCategory;
     this._activityOverride = errorCategory_Activity;
     this._reasonOverride = errorCategory_Reason;
     this._targetNameOverride = errorCategory_TargetName;
     this._targetTypeOverride = errorCategory_TargetType;
     this._serializedErrorCategoryMessageOverride = errorCategory_Message;
     if (errorDetails_Message != null)
     {
         this._errorDetails = new System.Management.Automation.ErrorDetails(errorDetails_Message);
         if (errorDetails_RecommendedAction != null)
         {
             this._errorDetails.RecommendedAction = errorDetails_RecommendedAction;
         }
     }
 }