Skip to content

Commit c6ced19

Browse files
committed
Add IsTerminatingError function
1 parent 78afc1a commit c6ced19

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ protected override void ProcessRecord()
671671
base.ProcessRecord();
672672
ExecuteCmdlet();
673673
}
674-
catch (Exception ex) when (!(ex is PipelineStoppedException) && ex.InnerException != null)
674+
catch (Exception ex) when (!IsTerminatingError(ex))
675675
{
676676
WriteExceptionError(ex);
677677
}
@@ -697,5 +697,15 @@ public void Dispose()
697697
Dispose(true);
698698
GC.SuppressFinalize(this);
699699
}
700+
701+
public virtual bool IsTerminatingError(Exception ex)
702+
{
703+
if (ex is PipelineStoppedException && ex.InnerException == null)
704+
{
705+
return true;
706+
}
707+
708+
return false;
709+
}
700710
}
701711
}

0 commit comments

Comments
 (0)