| error() | rethrow() | throw() | traceback() |
error()
ERROR error()
This function returns the error code associated with the current error. This function can only be called from within an error handler. For more information see Errors.
if (error() == ~methodnf)
.message(strfmt("The method (%s) could not be found.", meth));
rethrow()
rethrow(ERROR code)
This function continues propagation of an error condition. The interpreter will abort the current method and throw the error specified by code in the calling method. Calling this function outside of an error handler will result in ~error being thrown.
throw()
throw(ERROR code, STRING explanation[, ANY additional])
This function throws an error with the code code in the calling method, not the current method. The current method does not have the ability to stop an error originating in itself. The variables explanation and additional appear in the traceback. For more information on error handling see traceback() and Errors.
throw(~perm, "Sender is not system secure");
traceback()
LIST traceback()
This function returns the propagated error stack. The first element in the traceback list is the error condition, the second element is what caused the error. The subsequent errors describe the method call stack from the point of origin. The error condition list is ordered as follows:
- ERROR - error code.
- STRING - explanation of error.
- ANY - additional data passed by the error.
The second element (what caused the error) will vary, depending upon where the error came from. If the error came from an operator, function or native method, it is a two element list:
- SYMBOL - one of 'opcode, 'function or 'native.
- SYMBOL - operator or the name of the function/native method.
If the error originated in a method, this list is ordered as:
- 'method
- SYMBOL - name of method which generated the error.
- OBJNUM - the object on which the method was called.
- OBJNUM - the object defining the method in which the error occurred.
- INTEGER - the line in the method that generated the error.
All other elements are ordered as:
- ERROR - error code.
- SYMBOL - name of method which generated the error.
- OBJNUM - the object on which the method was called.
- OBJNUM - the object defining the method in which the error occurred.
- INTEGER - the line in the method that generated the error.
Keep in mind that the error code will change to ~methoderr when it propagates, unless the propagation expression is used. See the section Errors for more information. A full traceback might look like:
[[~numargs, "Called with no arguments, requires one.", 0],
['function, 'listlen],
[~numargs, 'command_history, $admin_atyreus, $admin, 1],
[~methoderr, 'tmp_eval_855796437, $admin_atyreus, $creator, 1]]