Active IQ Unified Manager Discussions

WFA 2.1 RC bug report

igorf
3,264 Views

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
}

3 REPLIES 3

shailaja
3,264 Views

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

Shailaja

kiessl
3,264 Views

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

igorf
3,264 Views

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

Public