Programmer Guide/Command Reference/EMSG: Difference between revisions
From STX Wiki
Jump to navigationJump to search
No edit summary |
m (Text replace - "S_TOOLS-STx" to "{{STX}}") |
||
Line 4: | Line 4: | ||
EMSG <var>tableItem</var> | EMSG <var>tableItem</var> | ||
The <code>EMSG</code> command will return a string describing the meaning of the numerical error code <var>errorCode</var> returned by an | 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). | ||
// store all error messages in a simple table | // store all error messages in a simple table |
Revision as of 16:56, 5 April 2011
#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)