Skip to content

Add check in ProcessRecord to handle PipelineStoppedException #4504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Common/Commands.Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ protected override void ProcessRecord()
base.ProcessRecord();
ExecuteCmdlet();
}
catch (Exception ex)
catch (Exception ex) when (!IsTerminatingError(ex))
{
WriteExceptionError(ex);
}
Expand All @@ -697,5 +697,16 @@ public void Dispose()
Dispose(true);
GC.SuppressFinalize(this);
}

public virtual bool IsTerminatingError(Exception ex)
{
var pipelineStoppedEx = ex as PipelineStoppedException;
if (pipelineStoppedEx != null && pipelineStoppedEx.InnerException == null)
{
return true;
}

return false;
}
}
}