Skip to content

Commit c7f132d

Browse files
authored
Merge pull request Azure#4504 from cormacpayne/pipeline-exception
Add check in ProcessRecord to handle PipelineStoppedException
2 parents cde84a1 + 54686fa commit c7f132d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 12 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)
674+
catch (Exception ex) when (!IsTerminatingError(ex))
675675
{
676676
WriteExceptionError(ex);
677677
}
@@ -697,5 +697,16 @@ public void Dispose()
697697
Dispose(true);
698698
GC.SuppressFinalize(this);
699699
}
700+
701+
public virtual bool IsTerminatingError(Exception ex)
702+
{
703+
var pipelineStoppedEx = ex as PipelineStoppedException;
704+
if (pipelineStoppedEx != null && pipelineStoppedEx.InnerException == null)
705+
{
706+
return true;
707+
}
708+
709+
return false;
710+
}
700711
}
701712
}

0 commit comments

Comments
 (0)