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 mLipok)

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 mLipok, 10 years ago

Description: modified (diff)

comment:2 by J-Paul Mesnage, 10 years ago

In fact

;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.8\3.3.8.1\install\		; not detected
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.10\3.3.10.2\install\	; OK
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.12\3.3.12.0\install\	; OK
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.0\install\	; OK
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.6\install\	; OK
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.7\install\	; not detected
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.9\install\	; not detected
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.12\install\	; not detected
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.13\install\	; Fatal Error
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.18\install\	; Fatal Error
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.13\3.3.13.21\install\	; Fatal Error
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.14\3.3.14.2\install\	; Fatal Error
;~ #AutoIt3Wrapper_Autoit3Dir=d:\AutoIt_Tags\3.3.15\3.3.15.0\install\	; Fatal Error

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

comment:4 by J-Paul Mesnage, 6 years ago

Owner: set to J-Paul Mesnage
Status: newassigned

Hi,
FIx sent to Jon

comment:5 by mLipok, 6 years ago

Thanks again.

comment:6 by Jon, 5 years ago

Milestone: 3.3.15.4
Owner: changed from J-Paul Mesnage to Jon
Resolution: Fixed
Status: assignedclosed

Fixed by revision [12553] in version: 3.3.15.4

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.