.. highlightlang:: us .. index:: error .. _error: error ===== .. us.tag error ENGLISH Programming.Exceptions :ref:`error` prints an error message into the command window and terminates the execution of the running program. .. function:: error() error(ssMessage) .. us.return **Return Value** This function does not return to the function where the :ref:`error` function was called and therefore has no return value. .. us.params **Parameters** .. uparam:: ssMessage *ssMessage* is a scalar string, which the function will print into the command window and/or a message box, see :ref:`config`. The message box will not be displayed if the function is invoked in try-except block, see :ref:`try-except `. .. us.comment **Comment** The :ref:`error` function will create an exception (ICERR_USER_ERROR). .. us.example **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; } .. seealso:: :ref:`overview-programming`, :ref:`GetExceptionCode`, :ref:`GetExceptionInfo`, :ref:`config`. :ref:`try-except ` :sub:`id-918964`