minor change to PscxInputObjectPathCommandBase

Topics: Developer Forum
Jan 4, 2007 at 2:30 AM
I changed TryInvokeAction(Type,object) to throw the base exception instead of the standard TargetInvocationException:

PS C:\Documents and Settings\Oisin> dir | write-gzip | write-zip -OutputPath test.zip
Write-GZip : The process cannot access the file 'C:\Documents and Settings\Oisin\test.zip' because it is being used by
another process.
At line:1 char:17
+ dir | write-gzip  <<<< | write-zip -OutputPath test.zip

Previous this would say Write-Gzip: An exception has been thrown by the target of an invocation.

Since this is my first delvings into the base classes, I thought I should announce it here. Future minor delvings might not be.
Jan 4, 2007 at 2:32 AM
Also, I think it might be worthwhile to investigate a mechanism to allow the pipeline to continue, while logging errors like these. I would argue this is non-fatal.

- Oisin
Jan 4, 2007 at 2:50 AM
please add a ProcessWrite method to the PscxCmdlet.IPscxFileHandler.cs, and use the ErrorHandler.WriteFileError to log the exception as a non-terminating error.
Jan 4, 2007 at 2:51 AM
btw, I know the delegate should be looking after its own errors generally, but is TargetInvocationException worth a damn at this level in the stack? Unhandled exceptions end up getting eaten by powershell and it is impossible to see the innerexception without attaching a debugger.

- Oisin
Jan 4, 2007 at 2:55 AM
Ok, will do Jachym. Thanks for the pointer.