Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2024 closed Feature Request (Rejected)

Add AutoIt.Error object property for script or file name.

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Reproducer (if necessary):

include.au3:

#include-once

Func _test()
  Local $oIE = ObjCreate("InternetExplorer.Application.1")

  $oIE.UnknownMethod
  Local $err = @error

  $oIE.Quit()

  Return SetError($err)
EndFunc

Main.au3:

#include "include.au3"

Global $g_eventerror = 0
Global $oMyError = ObjEvent("AutoIt.Error", "_MyErrFunc")

_test()

If $g_eventerror Then
  $g_eventerror = 0
  MsgBox(0, "AutoItCOM test", "Test passed: We got an error number: " & @error)
Else
  MsgBox(0, "AutoItCOM test", "Test failed!")
EndIf

Exit

Func _MyErrFunc()
  ConsoleWrite("We intercepted a COM Error !" & @CRLF & @CRLF & _
      "err.description is: " & @TAB & $oMyError.description & @CRLF & _
      "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
      "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _
      "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
      "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
      "err.source is: " & @TAB & $oMyError.source & @CRLF & _
      "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
      "err.helpcontext is: " & @TAB & $oMyError.helpcontext & @CRLF _
      ; Something like
;~    "err.scriptname is: " & @TAB & $oMyError.scriptname & @CRLF _
      )

  Local $err = $oMyError.number
  If $err = 0 Then $err = -1

  $g_eventerror = $err
EndFunc

Attachments (0)

Change History (2)

comment:1 by trancexx, 14 years ago

Resolution: Rejected
Status: newclosed

Some time in the future you will see how meaningless that is.

in reply to:  1 comment:2 by anonymous, 14 years ago

Replying to trancexx:

Some time in the future you will see how meaningless that is.

Meanwhile, it's annoying to search in which file the offending line of code
resides; unless, of course, the dev team is working on a different paradigm for
trapping COM errors.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


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