Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Scilab > Error handling > error

error

error message

Syntax

error(message)
error(message, n)
error(n)
error(n, message)
error(n, pos)

Arguments

message

a string or a vector of strings. The error message to be displayed.

n

an integer. The number associated with the error message.

pos

an integer. A parameter for the error message.

Description

error function allows to issue an error message and to handle the error. By default error stops the current execution and resume to the prompt level. This default can be changed using the execstr(...,'errcatch') functions.

error(message) prints the character string contained in message. The number associated with the error message is 10000

error(message,n) prints the character string contained in message. The number associated with the error message is given by n. This number should be greater than 10000.

error(n) prints the predefined error message associated with the error number n.

Some predefined error messages require a parameter (see error_table). In this case the pos argument must be used error(n,pos) to give the parameter value. In the other cases the pos argument is ignored.

See error_table for a list of error messages and the associated error numbers.

Examples

error('my error message')
error(43)
error(52, 3)
error(10001, ['A'; 'multi';'line';'error';'message'])
lasterror()

See also

History

VersionDescription
5.4.0 The error function can take vector of strings as input argument.
Report an issue
<< errclear Error handling error_table >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:02:38 CET 2017