Sergiy--
Error codes above 9999 are probably safe, though Stata can reclaim or
reassign error codes as they see fit--e.g. errors 3000-3999 pre- and
post-Mata. Note also that
version 5: error 3001
does not recover old error codes! It's safer to use an error code
that Stata already assigns a message to, preferably one that seems
unlikely to be reassigned (198 is safest).
One can construct one's own list of predefined informative error codes
for the current version like so:
clear all
prog errors
tempfile e l
tempname t
file open `t' using `e', write replace
forv i=1/9999 {
file write `t' _n "error `i'"
}
file write `t' _n
file close `t'
cap log close
cap log using `l', text
do `e', nostop
cap log close
insheet using `l'
end
errors
g err=real(substr(v1,9,.))
g msg=v1[_n+1]
drop if mi(err)
drop if mi(msg)
drop if substr(msg,1,2)=="r("
drop if msg=="Mata run-time error"
brow err msg
On Fri, Aug 29, 2008 at 1:35 PM, Sergiy Radyakin <[email protected]> wrote:
> Thank you Kit, it's my fault.
>
> When I asked this question 4 weeks ago, nobody responded, so I assumed
> this was true. http://www.stata.com/statalist/archive/2008-08/msg00154.html
>
> QUOTE:
> "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?"
>
> Regards, Sergiy
>
>
>
> On 8/29/08, Kit Baum <[email protected]> wrote:
>> < >
>> Sergiy asserted
>>
>> Since Stata does not
>> provide a list of all defined error codes, there is no easy way of
>> knowing how to generate a particular error message.
>>
>> That annotated list appears in [P] error.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/