[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Return codes range

From   "Sergiy Radyakin" <>
To   "" <>
Subject   st: Return codes range
Date   Tue, 5 Aug 2008 12:30:05 -0400

Dear all,

the online help for the -error- statement does not decribe the range
for the argument. Is it described somewhere else? The problem I face
is that I find particularly convenient to return negative return codes
not to conflict with the error codes reserved for Stata. So my plugin
returns codes like -1, -2, -3 etc. In the .ado wrapper I analyse this
code, issue an error message and abort with the same error code.

Note that Stata 10 correctly shows code _rc = -1 in the review window after:

plugin call FooBarExternal

program FooBar

capture plugin call FooBarExternal `0'
if (_rc!=0) {
  if (_rc==-1) display "Not enough arguments. Alpha must be specified."
  if (_rc==-2) display "Not enough arguments. Beta must be specified."
  error _rc


program define FooBarExternal, plugin using("FooBar.plu" )

When I call FooBar from a .do file, I capture and analyse the return
code. However I never see my values -1, -2, -3. After some trials, the
problem seems to be in the -error- command:

. error -1

So regardless of the code, the value will be 100000. Is this intended?

Which error codes are reserved for Stata use? Is there a full list of
these codes (and messages if possible)? Which codes may a Stata
programmer use for his/her own commands?

Thank you,
   Sergiy Radyakin
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index