Sign in to follow this  
Followers 0
plastix

Redefine / Release Com Error Handling

4 posts in this topic

Hi all.

I am using COM error handling in a script using standard:

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
This works nicely. The script can produce some object errors in various places by virtue of working with COM etc... it would be nice to be able to handle COM errors differently if they arise in various parts of the script. I have noticed some of the descriptors available ie err.number, err.source etc - but nothing that would indicate which function in the script the error arose in (which would ease custom handling). An alternative would be to redefine the COM error handling script (as above) - but i don't think that is possible without releasing the $oMyError object for the event - is this possible ?

So, my questions are:

1. Can COM error handling determine which function the error arose in ?

2. Can you redefine the ObjEvent("AutoIt.Error") handling in a script ?

TIA :think:

Share this post


Link to post
Share on other sites



the err.scriptline should tell you where the error arose, no?


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

Hi all.

I am using COM error handling in a script using standard:

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
This works nicely. The script can produce some object errors in various places by virtue of working with COM etc... it would be nice to be able to handle COM errors differently if they arise in various parts of the script. I have noticed some of the descriptors available ie err.number, err.source etc - but nothing that would indicate which function in the script the error arose in (which would ease custom handling). An alternative would be to redefine the COM error handling script (as above) - but i don't think that is possible without releasing the $oMyError object for the event - is this possible ?

So, my questions are:

1. Can COM error handling determine which function the error arose in ?

2. Can you redefine the ObjEvent("AutoIt.Error") handling in a script ?

TIA :think:

to question 2

$oMyError = 0 ; removes the object

at that point you can declare another ObjEvent


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

many thanks cdkid & gafrost.

Setting the error object $oMyError = 0 doesn't seem to work. I suspect there is a limitation to this method specifically for AutoIt. I'll continue experimenting...

Edited by plastix

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0