![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Handling Errors from COM components I have some problems handling Errors returned after invoking a COM/Automation object. I read the "Sapiens TFM" sample chapter (which explains things quite clearly I thought) but I am missing something I would be happy with the original error text, plus the script terminating. However, here's what I see: I have a dev.ps1 script that defines a global function, which creates an Automation object, passes this to a local function, which uses it. The following happens if the call on the Automation Object returns an error: (1) Without "trap", poweshell displays an error (location of call, and error message from Automation object). Very useful! Unfortunately, the script continues with the next command (2) A "trap" added to the top of the script file gets never called. Same Behavior as under (1) (3) A "trap" added to the actual function calling the COM object gets called, but the $_ object seems empty. neither Write-Host $_ nor Write-Host $_.Exception.Message display anything. However, I could "Throw" here to terminate the script, but this displays no helpful message. Any ideas? Trap { Write-Host "ERRORINNER" Write-Host $_.Exception.Message Throw } thanks! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Uh-Oh are my main components too hot!?! | isikh | Overclocking & Cooling | 11 | 2 Weeks Ago 01:53 AM |
| handling errors in a script | Darren Mar-Elia | PowerShell | 4 | 11-29-2007 07:56 PM |
| Do I need these Windows components? | Larry E | Vista General | 4 | 11-18-2007 07:21 AM |
| explorer errors, program errors, no task manager | EmilyD | Vista performance & maintenance | 3 | 11-13-2007 09:14 PM |
| What are Serviceable Components? | Shayne H | Vista installation & setup | 3 | 11-11-2007 08:15 PM |