Jump to content

Exception handling in AutoIt


amokoura
 Share

Recommended Posts

Here's a template for simulating exceptions.

$exceptionCode = 0

;;; TRY
Do 
; Perform possibly erroneous functions
; In case of error:
;   $exceptionCode = [integer]
;   ExitLoop
; and the rest of the try block will not be executed
Until 1
    
    
;;; CATCH
Switch $exceptionCode
    Case 0      ; no exception
    Case [integer]; specific exception
    case Else   ; unknown exception
EndSwitch


;;;;FINALLY
; Perform finalizing functions here
;
; If we want to pass exception code back in call stack:
; setError($exceptionCode)

I posted this before in support forums but that was the wrong place.

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...