12.5.11.1   Display Errors from a script

The following is a method to display an error in WebAccess scripts

 

# runs script source.scr - traps and displays if error

# Failed. couldn't read file "sourcein.scr": no such file or directory

# it splits the error in to two tags  using the strung command.  Errors can be longer than 70 charcaters, the maximum text tag length.

if {[catch [list SCREXEC sourcein.scr] err]} {

   SETVAL "text=Failed. $err "

   SETVAL text50=[string range $err 61 112]

}

 

Another version allows you to enter the name of the Script to be tested in a Text-type tag.

 

# This script calls whatever script is entered in text tag named SCRname

# the scr extension should be added

# SCRERR displays the error on a Display named ScriptTest.bgr

catch {

SCREXEC [GETVAL SCRname]

} err

SETVAL SCRERR=$err