Previous topic

eig

Next topic

error_create

This Page

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. If the message text consists of a single exclamation mark (!) or begins with an exclamation mark, an exception is created without displaying a message box.

Comment

The error function will create an exception.

Example

def read_text_file(ssFileName)
{
  if (nargsin() == 0) {
      error("missing filename")
  }
  fp = fopen(ssFileName, "r");
  if (fp == 0) {
      error("cant open " + ssFileName)
  }
  ssText = fread(fp, "char");
  flose(fp);
  return ssText;
}

id-918964