In the command "cm_storage / Create volume" the following code will not be able to catch any exceptions:
try
{
Invoke-Expression $expression -ErrorAction stop
}
catch
{
throw "Failed to create new volume: " + $VolumeName + ". Message: " + $_.Exception.Message
}
An exception eventually happens while attempt to set volume options for the volume which does not exist.
This code will cause the loss of valuable diagnostics about why volume was not created.
It also causes confusion on set options calls.
Proposed quick fix:
try
{
$erroractionpreference = "Stop"
Invoke-Expression $expression -ErrorAction stop
}
catch
{
throw "Failed to create new volume: " + $VolumeName + ". Message: " + $_.Exception.Message
}