Category:Errorcodes

From Bennu Wiki
Revision as of 16:23, 15 April 2007 by Sandman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Errorcodes are constants that get generated by a function or another piece of code, when there occurs a malfunction. For example when you try the following code with the Network.DLL function NET_Connect():

if( (netid = NET_Connect("some-not-existing-server",1234)) < 0 )
    //error
else
    //success
end

The code NET_ERROR_CONNECTING is returned, which in fact is the value -20, which is less than 0, so we go into the //error section. Here we can for example output the error:

say("Error: " + NET_GetError(netid));

Or perform an action based on the type of error:

switch(netid)
    case NET_ERROR_CONNECTING:
        say("Could not connect to the specified server.");
    end
    case NET_ERROR_TOOMANYCONNS:
        say("There are too many connections open at this point.");
    end
end


Note that errorcodes do not necessarily have to be negative numbers; Network.DLL does this so the check of an error is just the check if the returned value is negative.


Below is a list of errorcodes generated by DLL's and others.

Pages in category "Errorcodes"

The following 2 pages are in this category, out of 2 total.