Jump to content

trying to understand error handler


Recommended Posts

after registering these error handlers:

$COM_Error = ObjEvent("AutoIt.Error", "COM_Error")
_IEErrorHandlerRegister()

Func COM_Error()

    MsgBox(262144, "Dashboard", $COM_Error.description & @CRLF & _
            "" & @CRLF & _
            "Script Line: " & $COM_Error.scriptline)

EndFunc   ;==>COM_Error

i get weird errors. i get an error for this line upon script startup

$noteslink_input = GUICtrlCreateInput("", 120, 40, 280, 20)

after running this function:

Func Links_Altiris()
    $oIE = _IECreate("http://altirisams/Altiris/NS/", 0)
EndFunc   ;==>Links_Altiris

i get an error for this line AND a blank line:

$fcolor_btn = GUICtrlCreateButton("", 120, 153, 40, 20)

i also get this in the console when i run the function above (which confuses me - says to register ierrorhandlerregister.. uhh thought i did!) :

--> IE.au3 V2.4-0 Error from function _IEPropertySet, $_IEStatus_GeneralError (Error Handler Not Registered - Check existance of error function)

--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

--> IE.au3 V2.4-0 Warning from function _IELoadWait, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

thank you in advance for your help Edited by gcue
Link to comment
Share on other sites

IE error handler uses the object event... use one or the other only

;===============================================================================
;
; Function Name:   _IEErrorHandlerRegister()
; Description:      Register and enable a user COM error handler
; Parameter(s):     $s_functionName - String variable with the name of a user-defined COM error handler
;                                     defaults to the internal COM error handler in this UDF
; Requirement(s):   AutoIt3 V3.2 or higher
; Return Value(s):  On Success  - Returns 1
;                   On Failure  - Returns 0 and sets @ERROR
;                   @ERROR      - 0 ($_IEStatus_Success) = No Error
;                               - 1 ($_IEStatus_GeneralError) = General Error
;                   @Extended   - Contains invalid parameter number
; Author(s):        Dale Hohm
;
;===============================================================================
;
Func _IEErrorHandlerRegister($s_functionName = "__IEInternalErrorHandler")
    $sIEUserErrorHandler = $s_functionName
    $oIEErrorHandler = ""
    $oIEErrorHandler = ObjEvent("AutoIt.Error", $s_functionName)
    If IsObj($oIEErrorHandler) Then
        SetError($_IEStatus_Success)
        Return 1
    Else
        __IEErrorNotify("Error", "_IEPropertySet", "$_IEStatus_GeneralError", _
                "Error Handler Not Registered - Check existance of error function")
        SetError($_IEStatus_GeneralError, 1)
        Return 0
    EndIf
EndFunc   ;==>_IEErrorHandlerRegister

8)

NEWHeader1.png

Link to comment
Share on other sites

i went ahead and used this as myerrorfunction instead of the ie one

(id like to track the line number and description)

Func Custom_COM_Error()

    MsgBox(262144, "Dashboard", $Custom_COM_Error.Description & @CRLF & _
            "" & @CRLF & _
            "Script Line: " & $Custom_COM_Error.ScriptLine)

    $COM_Error = 1

EndFunc   ;==>Custom_COM_Error

seems to work better now that im only registering ONE error function =)

i still get this error when i run _iecreate (but functions works ok)

--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

Link to comment
Share on other sites

if i run iecreate with these switches (0, 1, 0, 1)

0-dont attach

1-browser is visible

0-return immediately, dont wait for page to load

1-bring window to focus

i get this error:

--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

with these switches (0, 0, 1, 0) on iecreate

0-dont attach

1-browser is NOT visible

0-wait for page to load

0-dont bring window to focus

i get these errors:

--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

--> IE.au3 V2.4-0 Warning from function _IELoadWait, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

and an error on line 4257 which i think is from the ie.au3 udf

$oTemp = $o_object.document

Edited by gcue
Link to comment
Share on other sites

Please study the Remarks in the documentation for _IEErrorHandlerRegister. It explains all of this in detail.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...