Riverwatcher Active Content Environment

RACE Documentation:

Debugging RACE Scripts

While as much as we try to make RACE an easy to use and intuitive language so you may write the perfect code the first time through, we have prepared a setup of debugging tools to help you when you don't. RACE reports errors and warning to you in one of the following three ways: in the error log of the web server or the syslog for RACE shell scripts, the output to the browser or the standard out for RACE shell scripts, and finally the <@system.errors>, <$system.error> and <$database.error>.

Generally speaking, severe errors or errors not caught by the RACE interpreter are reported in the web server error log or the syslog. Errors with bad syntax or improper usage are reported to the output stream so that it is immediately visible to the developer when executing the script. Finally, most warnings and run time errors are found in the @system.errors array. The $system.error contains the error from most recent RACE code execution. If $system.error is empty, then you know the last line of RACE code did not generate any errors.

The <$database.error> is part of the %database hash. It will only contain any errors resulting from a database query.

Additional error logging maybe turned on or off by using the system tag, e.g.:

<system debug="on"> and <system debug="off">

You can also output your own messages to the error log with the system tag, e.g.:

<system message="before the for loop">
<for key="$id" list="">
  <system message="inside the for loop, $id is <$id>">
<system message="after the for loop">

If you would like to know at any given point what variables and tags are defined, you can use the dump attribute of the system tag to find out.

<system dump="vars"> <system dump="tags">

You can use the asis tag to temporary comment out code segments in your script so that they will not be executed by the RACE interpreter. You can also use the asis tag to add comments to your script, unlike HTML comments, they will be stripped out and not be sent to the browser.

<asis>the following will be not executed</asis>
<for key="$id" list="<@studentids>">

Finally, many developers pepper their scripts with the output tag to log message to a file of their choosing.

<output file="mylog" append>before the for loop</output>
<for key="$id" list="<@studentids>">
  <output file="mylog" append>
inside the for loop, $id is <$id>
<output file="mylog" append>
after the for loop</output>

RACE Documentation

Copyright 2009 Riverwatcher, Inc. Hosting by Riverwatcher Studios