You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The functions are throwing custom errors rather than passing the original error back out which is problematic. I ran into an issue when trying to wrap your module into another function where the drsrule functions were failing because I wasn't importing the vmware module into the global scope. So rather than the error displaying what was really happening (get-vm command not found) it was saying the vm itself wasn't found which was not the issue at all.
I changed the below with a possible alternative
try {
## limit scope to this cluster
$oThisCluster | Get-VM -Name $oThisVmItem -ErrorAction:Stop
}
catch {
#this commented out is the original message
#Throw "No VM of name '$oThisVmItem' found in cluster '$($oThisCluster.Name)'. Valid VM name?"
Throw "$($oThisCluster.Name) - Error looking up $oThisVmItem - $($_.Exception.Message)"
}
The text was updated successfully, but these errors were encountered:
Ah, yes, I can see how that is problematic. I will look into enhancing the module such it returns info about the "real" error that happens, not some assumption about what happened. Thanks for the sample snippet, too.
The functions are throwing custom errors rather than passing the original error back out which is problematic. I ran into an issue when trying to wrap your module into another function where the drsrule functions were failing because I wasn't importing the vmware module into the global scope. So rather than the error displaying what was really happening (get-vm command not found) it was saying the vm itself wasn't found which was not the issue at all.
I changed the below with a possible alternative
The text was updated successfully, but these errors were encountered: