RaiseError Method

Raises an A-Shell error.

Syntax

Application.RaiseError ErrorNumber

Parameters

ErrorNumber

A Long value containing the number of the error to raise.

Remarks

The RaiseError method is the recommended way to communicate the occurrence of unexpected or fatal errors to A-Shell. If an AlphaBASIC program is running in A-Shell at the time (as would be the case if the RaiseError method were called within an XCALL subroutine), then the effect would be as if the specified error had occurred by other means.

For example, consider an AlphaBASIC program with simple error trapping, such as that shown here:

    on error goto Trap
    …
    xcall TEST,…
    …
Trap:
    print err(0)
    …

If TEST were a COM XCALL subroutine, which raised an error with the RaiseError method, then control would immediately transfer to the error handler at the ‘Trap:’ label, and the raised error number would be accessible through the AlphaBASIC ERR(0) function.