Sign in to follow this  
Followers 0
Ayres

Treatment of Errors

4 posts in this topic

;) Some programming languages allow that if it defines an error routine that always will be executed when some error to occur in the execution of the program. The AUTOIT has this resource?

Share this post


Link to post
Share on other sites



one direction is "SetError "

$result = myDiv(5, 0)
If @error Then
    MsgBox(4096,"Error", "Division by Zero")
Else
    MsgBox(4096, "Result", $result)
EndIf
Exit

the other is "RunErrorsFatal"

Sets if the script should terminate with a fatal error if a Run/RunWait function fails due to bad paths/file not found/Bad login IDs:

1 = fatal error (default)

0 = silent error (@error set to 1)

you can find both of these in help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

one direction is "SetError "

$result = myDiv(5, 0)
If @error Then
    MsgBox(4096,"Error", "Division by Zero")
Else
    MsgBox(4096, "Result", $result)
EndIf
Exit

the other is "RunErrorsFatal"

Sets if the script should terminate with a fatal error if a Run/RunWait function fails due to bad paths/file not found/Bad login IDs:

1 = fatal error (default)

0 = silent error (@error set to 1)

you can find both of these in help

No.  Necessary of something thus: 

Start program

-----------------------------------------------------

If error go to treatment of error

-----------------------------------------------------

.

.

Program

.

.

Exit

----------------------------------------------------

Treatment of error

----------------------------------------------------

.

.

Program of treatment of error

.

.

Return

----------------------------------------------------

8)

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

opt("runErrorsFatal", 0)

run("myProgram.exe")
if (@error) then handleLaunchError()
···
···
···

func handleLaunchError()
    ···
    ···
    ···
endFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0