Programmer Guide/Command Reference/EMSG: Difference between revisions

From STX Wiki
Jump to navigationJump to search
(initial import)
 
mNo edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
==EMSG==
{{Command Reference}}
#emsg := EMSG <var>errorCode</var>
or
EMSG <var>tableItem</var>


<code>#emsg := EMSG <var>errorCode</var>|<var>table</var></code>
The <code>EMSG</code> command will return a string describing the meaning of the numerical error code <var>errorCode</var> returned by an {{STX}} command. If a table item (<var>tableItem</var>) is passed instead of an error code, all error descriptions are stored in the table (deleting the previous contents).


The <code>EMSG</code> command will return a string describing the meaning of a numerical error (<var>errorCode</var>) returned by an S_TOOLS-STx command. If a table item (<var>table</var>) is passed instead of an error code, all error descriptions are stored in the table (deleting the previous contents).
// store all error messages in a simple table
 
#tab := new table *
<pre>
EMSG $#tab
// store all error messages in a simple table
#tab := new table *
// show this table to the user
EMSG $#tab
showitem $#tab
</pre>
// tidily dispose of the table after use
delete /Var #tab
or
or
 
// check if command fails and display error message on error
<pre>
#spu := new spu * testspu pa pb pc
// check if command fails and display error message on error
if '$rc' > 0 em $rc ; SPU creation failed: $(emsg $rc)
#spu := new spu * testspu pa pb pc
<!-- C.G. 23.3.2011 -->
if '$rc' > 0 em $rc ; SPU creation failed: $(emsg $rc)
</pre>

Latest revision as of 08:40, 13 May 2015

#emsg := EMSG errorCode

or

EMSG tableItem

The EMSG command will return a string describing the meaning of the numerical error code errorCode returned by an STx command. If a table item (tableItem) is passed instead of an error code, all error descriptions are stored in the table (deleting the previous contents).

// store all error messages in a simple table
#tab := new table *
EMSG $#tab

// show this table to the user
showitem $#tab

// tidily dispose of the table after use
delete /Var #tab

or

// check if command fails and display error message on error
#spu := new spu * testspu pa pb pc
if '$rc' > 0 em $rc ; SPU creation failed: $(emsg $rc)

Navigation menu

Personal tools