Skip to content

Commit

Permalink
Fix for issue #831
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamNaj committed Feb 15, 2017
1 parent eaf03ed commit e435715
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion Cognifide.PowerShell/Core/Provider/PsSitecoreItemProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ protected void GetChildItemsWithDepth(string path, bool recurse, uint depth)
GetChildItemsHelper(item, recurse, wildcard, language, version, 0, depth);
}
}
catch (PipelineStoppedException)
{
// pipeline stopped e.g. if we did:
// Get-ChildItem master:\ | Select-Object -First 1
// we can relax now - no more items needed
}
catch (Exception ex)
{
LogError(ex,
Expand Down Expand Up @@ -218,6 +224,12 @@ protected override void GetChildNames(string path, ReturnContainers returnContai
WriteInvalidPathError(path);
}
}
catch (PipelineStoppedException)
{
// pipeline stopped e.g. if we did:
// Get-ChildItem master:\ | Select-Object -First 1
// we can relax now - no more items needed
}
catch (Exception ex)
{
LogError(ex,
Expand All @@ -229,7 +241,16 @@ protected override void GetChildNames(string path, ReturnContainers returnContai

protected override void GetItem(string path)
{
GetItemInternal(path, true).ForEach(WriteItem);
try
{
GetItemInternal(path, true).ForEach(WriteItem);
}
catch (PipelineStoppedException)
{
// pipeline stopped e.g. if we did:
// Get-Item master:\ -Language * | Select-Object -First 1
// we can relax now - no more items needed
}
}

internal IEnumerable<Item> GetItemInternal(string path, bool errorIfNotFound)
Expand Down Expand Up @@ -435,6 +456,10 @@ protected override void CopyItem(string path, string destination, bool recurse)
: TransferItem(sourceItem, destinationItem, leafName, recurse);
WriteItem(itemCopy);
}
catch (PipelineStoppedException)
{
// pipeline stopped e.g. by `Select-Object -First 1`
}
catch (Exception ex)
{
LogError(ex,
Expand Down Expand Up @@ -729,6 +754,10 @@ protected override void NewItem(string path, string itemTypeName, object newItem

WriteItem(createdItem);
}
catch (PipelineStoppedException)
{
// pipeline stopped e.g. by `Select-Object -First 1`
}
catch (Exception ex)
{
LogError(ex,
Expand Down

0 comments on commit e435715

Please sign in to comment.