Modify ↓
Opened 10 years ago
Closed 5 years ago
#3167 closed Bug (Fixed)
COM Error Handler - not always fires event
| Reported by: | mLipok | Owned by: | Jon |
|---|---|---|---|
| Milestone: | 3.3.15.4 | Component: | AutoIt |
| Version: | 3.3.15.0 | Severity: | None |
| Keywords: | Cc: |
Description (last modified by )
Discussion:
https://www.autoitscript.com/forum/topic/178424-com-error-handler-not-working-for-some-strange-reason/
Here is reproducer:
; Initialize COM error handler
$oErrorHandler = ObjEvent("AutoIt.Error", _ErrFunc)
Func _ErrFunc($oError)
ConsoleWrite("!ERROR caught" & @CRLF)
EndFunc
; Create shell object
$oObj = ObjCreate("shell.application")
;The following line should trigger COM error handler (at the last dot).
$oObj.Windows().Item(666).bzzzzzzz
Here are some of my test results:
;~ #AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\AutoIt_3.3.8.1\ ; NOTHING ;~ #AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\AutoIt_3_3_10_2\ ; !ERROR caught ;~ #AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\AutoIt_3_3_12_0\ ; !ERROR caught ;~ #AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\AutoIt_3_3_13_12\ ; NOTHING ;~ #AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\AutoIt_3_3_13_15\ ; BUG/ISSUE EXIST ;~ #AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\AutoIt_3_3_13_19\ ; BUG/ISSUE EXIST ;~ #AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\AutoIt_3.3.15.0\ ; BUG/ISSUE EXIST
Attachments (0)
Change History (6)
comment:1 by , 10 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
For reference
Link to other discussion in MVP forum:
https://www.autoitscript.com/forum/topic/176064-excel-com-error-handler-problem/
comment:6 by , 5 years ago
| Milestone: | → 3.3.15.4 |
|---|---|
| Owner: | changed from to |
| Resolution: | → Fixed |
| Status: | assigned → closed |
Fixed by revision [12553] in version: 3.3.15.4
Note:
See TracTickets
for help on using tickets.

In fact
In fact it was OK even with the reference to an unknown function in 3.3.10 till 3.3.13.6
3.3.13.7 reintroduce the no detection as 3.3.8.1
Example() Func Example() ; Error monitoring. This will trap all COM errors while alive. ; This particular object is declared as local, meaning after the function returns it will not exist. Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") #forceref $oErrorHandler ; Create shell object Local $oObj = ObjCreate("shell.application") ;The following line trigger COM error handler. $oObj.InvalidFunction() If @error Then ConsoleWrite("+COM Error Detected @error=0x" & Hex(@error) & @CRLF) Else ConsoleWrite("!COM Error Not Detected" & @CRLF) EndIf ;The following line should trigger COM error handler (at the last dot). $oObj.Windows().Item(666).bzzzzzzz If @error Then ConsoleWrite("+COM Error Detected @error=0x" & Hex(@error) & @CRLF) Else ConsoleWrite("!COM Error Not Detected" & @CRLF) EndIf EndFunc ;==>Example Func _ErrFunc($oError) ;~ #forceref $oError ConsoleWrite("+ERROR caught at ligne " & $oError.scriptline & " : " & StringTrimRight($oError.windescription, 2) & @CRLF) ;~ ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ ;~ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ ;~ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ ;~ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ ;~ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ ;~ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ ;~ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ ;~ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ ;~ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ ;~ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc