Re: NS_FAILED, NS_SUCCESS, and nsresult return values: suggested guidelines?

David Bradley <[email protected]> Mon, 16 Dec 2002 15:39:03 -0500
Newsgroups gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Nathan Kurz wrote:
> So is there a suggested guideline for what should be considered a
> failure and what a success?  There seem to be very few cases of
> NS_SUCCESS_CODE values in mozilla.  Is this a conscious design
> practice or just way things turned out?

In most all cases you can take the information indicated by a success 
code and provide an alternative mechanism for retrieving it. For 
instance, maybe you asked a database API for some data, and the buffer 
you provided was too small. It still succeeded in filling it, but 
there's more data. So it returns a success code indicating there's more 
data. Now the API could have had a parameter designated to receive this 
information, but maybe the success code was just perceived more convenient.

David