lasterror — get last recorded error message
str=lasterror( [opt] ) [str,n]=lasterror([opt]) [str,n,line,func]=lasterror([opt])
vector of character strings or an empty matrix. The last recorded error message.
integer, 0 or the last recorded error number.
integer, 0 or the last recorded function line number.
string,the last recorded function name
boolean, if %t recorded message is cleared. Default is %t.
Each time an error occurs, the Scilab error handler records it in
internal tables (only the last one is retained). The
lasterror
function allows to get the message, the error
number, the current function (if any) and the current line of the current
function out of these tables.
The line number reported is the physical line number where the last error occurred. Note that Scilab versions before 5.0 used to report the logical line number of the last error. The difference does matter only if the function in error includes continued lines before the point where the error happened.
This function is useful while using errcatch
or
execstr
.
The recorded error message may be retained for a further call to
lasterror
using
lasterror(%f)
.