|
Declared in: be/support/Errors.h
more...
Error codes are returned by various functions to indicate the success or to describe the failure of a requested operation.
All Be error constants except for B_OK (B_NO_ERROR) are negative integers; any function that returns an error code can thus be lazily tested for success or failure by the following:
if ( funcCall() < B_NO_ERROR )
/* failure*/
else
/* success*/
All constants (except B_NO_ERROR and B_ERROR) are less than or equal to the value of the B_ERRORS_END constant. If you want to define your own negative-valued error codes, you should begin with the value (B_ERRORS_END + 1) and work your way toward 0.
The BeOS supports the POSIX error code constants (these constants start with the letter "E", as in EBADF or ENOENT). A number of Be-defined constants are synonyms for the POSIX constants; for example, the Be equivalent for ENOENT is B_ENTRY_NOT_FOUND.Most of the General Error Codes, and all the File System Error Codes are covers for POSIX errors. The POSIX equivalents are listed where applicable.
The POSIX constants, and the Be synonyms, can be passed to the POSIX strerror() function. The function, defined in posix/string.h, returns a human-readable description of the error:
char *strerror(int error_code)
Code POSIX Description B_NO_MEMORY ENOMEM There isn't enough memory for the operation B_IO_ERROR EIO A general input/output error occurred B_PERMISSION_DENIED EACCESS Illegal access B_BAD_INDEX The index is out of range B_BAD_VALUE EINVAL An illegal value was passed to the function B_MISMATCHED_VALUE S Conflicting values were passed to the function B_BAD_TYPE An illegal argument type was named or passed B_NAME_NOT_FOUND There's no match for the specified name. B_NAME_IN_USE The requested (unique) name is already used B_BUSY EBUSY A device is busy, or a file is locked B_NOT_ALLOWED EPERM Operation not allowed B_NO_INIT An object or structure isn't properly initialized B_TIMED_OUT ETIMEDOUT Time expired before the operation was finished B_INTERRUPTED EINTR A signal interrupted the operation B_WOULD_BLOCK EAGAIN But you don't want to block B_WOULD_BLOCK EWOULD BLOCK Same as the above B_ERROR = -1 A convenient catchall for general errors B_NO_ERROR = 0 Everything's OK B_OK Same as B_NO_ERROR
Code Description B_BAD_THREAD_ID Specified thread identifier (thread_id) is invalid B_BAD_THREAD_STATE The thread is in the wrong state for the operation B_NO_MORE_THREADS All thread identifiers are currently taken B_BAD_TEAM_ID Specified team identifier (team_id) is invalid B_NO_MORE_TEAMS All team identifiers are currently taken B_BAD_PORT_ID Specified port identifier (port_id) is invalid B_NO_MORE_PORTS All port identifiers have been taken B_BAD_SEM_ID Semaphore identifier (sem_id) is invalid B_NO_MORE_SEMS All semaphores are currently taken B_BAD_IMAGE_ID Specified image identifier (image_id)is invalid B_NOT_AN_EXECUTABL E An executable image was expected B_BAD_ADDRESS Illegal address B_MISSING_LIBRARY A library needed by an application is missing B_MISSING_SYMBOL A symbol needed by an application is missing B_DEBUGGER_ALREAD Y_INSTALLED An attempt was made to install the debugger when it was already installed.
|
Copyright © 2000 Be, Inc. All rights reserved..