Errors | This document describes the way Octave reports errors. Octave for OS/2 Homepage. Read Me! History of Changes.

There are two classes of errors that Octave produces when it encounters input that it is unable to understand, or when it is unable to perform an action.

A parse error occurs if Octave cannot understand something you have typed. For example, if you misspell a keyword:

For most parse errors, Octave uses a caret (^) to mark the point on the line where it was unable to make sense of your input. In this case, Octave generated an error message because the keyword function was misspelled. Instead of seeing function f, Octave saw two consecutive variable names, which is invalid in this context. It marked the error at the y because the first name by itself was accepted as valid input.

Another class of error message occurs occurs at evaluation time. These errors are called run-time errors, or sometimes evaluation errors because they occur when your program is being run, or evaluated. For example, if after correcting the mistake in the previous function definition, you type

This error message has several parts, and gives you quite a bit of information to help you locate the source of the error. The messages are generated from the point of the innermost error, and provide a traceback of enclosing expressions and function calls.

In the example above, the first line indicates that a variable named x was found to be undefined near line 1 and column 24 of some function or expression. For errors occurring within functions, lines from the beginning of the file containing the function definition. For errors occurring at the top level, the line number indicates the input line number, which is usually displayed in the prompt string.

The second and third lines in the example indicate that the error occurred within an assignment expression, and the last line of the error message indicates that the error occurred within the function f. If the function f had been called from another function, for example, g, the list of errors would have ended with one more line:

    error: called from `g'

These lists of function calls usually make it fairly easy to trace the path your program took before the error occurred, and to correct the error before trying again.