I've got a small example of exception trapping that doesn't seem to be
working right, or at least how I would expect it to work:
Trap
{
'caught general exception: ' + $_.Exception.Message
}
function Test
{
trap [System.ComponentModel.Win32Exception]
{
'caught Win32 exception'
# re-throw exception
throw $_
}
# throw a non-win32 exception
throw 'string-exception'
}
When you invoke the Test function, none of the trap handlers get invoked.
Shouldn't the general trap handler get invoked in this case? It seems to be
the type-specific trap handler within the function that is causing the outer
trap handler to get ignored. If you remove the type from the function's
exception trap, then the outer exception trap will then work.
Is this right? Shouldn't I be able to catch a specific exception type and
allow all others to propogate to other handlers?
thanks,
david


