Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
Is it the WaitProcess that returns the error or the Close method?
The reason I ask that is that if the process being referenced by the arrProcess(i) doesn't exist, it won't have a close method. You should do an "If exists" test first to make sure the process exists before attempting to close it.
Otherwise, the only other thing I can suggest is to make sure that your array is actually returning a string. WaitProcess requires a string for the first parameter. To debug, try adding a "Log.Message" call before your assignment to see if it returns as a string.
Of course, the obvious question is whether or not arrProcess is propulated, how it's populated, with what, etc., because if the finalize routine is attempted without doing anything with that object, it won't work.
As for logging the error... the try/catch should work, assuming that the error is one that raises an exception and is not a syntax or other error in your code. Try putting that routine in a straight-up script routine and run it directly without putting it in your extension and see what happens.
The reason I ask that is that if the process being referenced by the arrProcess(i) doesn't exist, it won't have a close method. You should do an "If exists" test first to make sure the process exists before attempting to close it.
Otherwise, the only other thing I can suggest is to make sure that your array is actually returning a string. WaitProcess requires a string for the first parameter. To debug, try adding a "Log.Message" call before your assignment to see if it returns as a string.
Of course, the obvious question is whether or not arrProcess is propulated, how it's populated, with what, etc., because if the finalize routine is attempted without doing anything with that object, it won't work.
As for logging the error... the try/catch should work, assuming that the error is one that raises an exception and is not a syntax or other error in your code. Try putting that routine in a straight-up script routine and run it directly without putting it in your extension and see what happens.