errorΒΆ
error prints an error message into the command window and terminates the execution of the running program.
-
error
() -
error
(ssMessage)
Return Value
This function does not return to the function where the error function was called and therefore has no return value.
Parameters
-
ssMessage
ssMessage is a scalar string, which the function will print into the command window and/or a message box, see config.
The message box will not be displayed if the function is invoked in try-except block, see try-except.
Comment
The error function will create an exception (ICERR_USER_ERROR).
Example
def read_text_file(ssFileName)
{
if (nargsin() == 0) {
error("missing filename")
}
fp = fopen(ssFileName, "r");
if (fp == 0) {
error("cannot open " + ssFileName)
}
ssText = fread(fp, "char");
flose(fp);
return ssText;
}
See also
Overview Programming, GetExceptionCode, GetExceptionInfo, config. try-except
id-918964