SteelArrow supports full exception handling. By supporting exception
handling, error flow control can be completely configured by the developer.
If you are a C++ or Java developer, you will be right at home with this
supported functionality.
With exception handling, certain operations can be tried (with TRY), and
any errors that may be generated can be caught (with CATCH). As well,
user information errors can be thrown (with THROW).
The below code snippet shows an example of using TRY/CATCH:
<SATRY> <!--- TRY something --->
<SAQUERY DATASOURCE="someDS">
INSERT INTO table(col1,col2)
VALUES( '#PARAM.value1#', '#PARAM.value2#' )
</SAQUERY>
</SATRY>
<SACATCH ERRTYPE="DATABASE">
There was a database error!<BR>
</SACATCH>
<SACATCH ERRTYPE="SECURITY">
There was a security error!<BR>
</SACATCH>
|
Generated errors that are caught are stored in the ERROR table, and
can be accessed the same way as any other variable. As well, the context of the
error is maintained. This means that the CGI, PARAM or any other
SteelArrow table can be queried to determine its state at the time of the error.
The ERROR table will contain the following:
FILE |
Script that generated the error. |
LINE |
Line number corresponding to the error. |
ERRTYPE |
Type of error; one of the types listed above. |
MESSAGE |
Error message. |
DATA |
The data that caused the error to be generated; usually the corresponding SteelArrow tag. |
|