stoperror
set a watchpoint on a specified error
unstoperror
clear a watchpoint on a specified error
Calling Sequence
Parameters
Description
Examples
stoperror(errMsg)
unstoperror(errMsg)
errMsg
-
error message to watch for
The stoperror function sets a watchpoint on the specified error, and returns the current list of watchpoints. If no error is specified, the current list of watchpoints is simply returned.
When an error that is being watched occurs during execution of a procedure, and that error would not be trapped, the debugger is invoked, the error message is displayed, and the statement that caused the error is displayed.
When execution is stopped, any of the commands that cause execution to continue will immediately cause the error to be propagated, the error message to be displayed once again, and execution to terminate. In other words, one cannot prevent the error after it has invoked the debugger.
The special name `all`, if passed to stoperror, will cause the debugger to be invoked if any error occurs and would not be trapped.
The special name `traperror`, if passed to stoperror, will cause the debugger to be invoked if any error is trapped.
The errMsg is considered to be a prefix of the exception object's msgString. If the errMsg has n characters, only the first n characters of the msgString have to match the errMsg.
An error message passed in the form traperror["message"] will cause the debugger to be invoked if the error specified by "message" is trapped.
The debugger can be set to be invoked when a computation is interrupted by the user by issuing the command stoperror("interrupted").
The debugger can be set to be invoked when a computation running under a time limit (via the timelimit function) times out by issuing the command stoperror("time expired").
The debugger can be set to be invoked when an assertion failure (see ASSERT and interface(ASSERT) for details) occurs by issuing the command stoperror("assertion failed").
The debugger can be set to be invoked when an incorrect or insufficient number of arguments is passed to a function by issuing the command stoperror("invalid arguments").
The stoperror function cannot be used to invoke the debugger for the following errors:
out of memory
too many levels of recursion
object too large
The unstoperror function clears the watchpoints on the specified error and returns the current list of watchpoints. If no error is specified, all watchpoints are cleared.
Note: These examples illustrate the use of these debugger commands in Maple's command-line interface. In the standard (graphical) interface, the debugger runs in its own window, with controls for most of the common commands. See Interactive Maple Debugger for details.
f := proc(x) local a; a := x; g(x); x^2 end proc:
g := proc(x) 1/x end proc:
stoperror⁡`numeric exception: division by zero`
numeric exception: division by zero
f⁡0
Error, (in g) numeric exception: division by zero
g:
1 1/x
DBG> cont
See Also
debugger
Interactive Maple Debugger
stopat
stoplast
stopwhen
stopwhenif
Download Help Document