Subscribe

WFA 2.1 RC bug report

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
}

Re: WFA 2.1 RC bug report

Thanks for reporting. We have filed an internal bug to track the same.

Shailaja

Re: WFA 2.1 RC bug report

Hi,

very interesting.

I had a similar issue where the "try ... catch" block would not catch any exceptions. Instead the exception were raised at the end of the command execution in the workflow.

Is this quickfix a general possibility to make the try...catch work or a special case for the statement above (sorry, I'm no powershell guru).

Best Regards

Walter

Re: WFA 2.1 RC bug report

This seems limited to Invoke-Expression. I'm not powershell guru either