Setting up for the Internet
25
Making the script report errors
You can instruct the script to report any problems experienced during logging in.
There are two useful ways of doing this:
1.
At the point in the script where you think there could be a problem, use the
EXIT
command, together with one of the
pre-defined error strings, e.g.:
sendlogin:
SEND
“fred15”
WAIT
15
{
“word:” sendpass
}
GOTO
loginfail
loginfail:
EXIT
KErrLoginFail$
This section of script sends the username
fred15
, then waits to receive
word:
. If this is not received within 15
seconds, the script jumps to the
loginfail
procedure, which closes the script at the same time as reporting a login
failure.
There is a full list of the different errors that you can use with the
EXIT
command in the
EXIT
section of the script
glossary below.
2.
Use the
WAIT
command to wait for more than one response, including alternative responses which may indicate that
the server is reporting an error. E.g.
sendlogin:
SEND “fred15”
WAIT 15
{
“word:” sendpass
“nvalid” badlogin
“ncorrect” badlogin
“rror” failure
}
EXIT KerrTimeOut$
badlogin:
EXIT KErrLoginFail$
failure:
EXIT KErrGeneral$
In the above section of script, the machine sends the username
fred15
, then waits to receive
word:
. If this is received
within 15 seconds, the script jumps to the
sendpass
procedure (not detailed in the above extract). If, instead, your
machine receives the
nvalid
,
ncorrect
or
rror
prompts, the script will jump to either the
badlogin
or
failure
procedures, depending on the kind of error being reported. If none of the above messages are received within the
allowed time, the script will exit with a “timed out” message.