Declared in: be/support/Errors.h
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_FILE_ERROR | EBADF | A file error occurred |
B_FILE_EXISTS | EEXIST | And you don't want to clobber it |
B_ENTRY_NOT_FOUND | ENOENT | The requested entry doesn't exist |
B_NAME_TOO_LONG | ENAMETOOLONG | Leaf or pathname too long |
B_NO_MORE_FDS | EMFILE | No more file descriptors |
B_NOT_A_DIRECTORY | ENOTDIR | When it should have been |
B_IS_A_DIRECTORY | EISDIR | When it shouldn't be |
B_DIRECTORY_NOT_EMPTY | ENOTEMPTY | Attempt to delete a non-empty directory |
B_DEVICE_FULL | ENOSPC | Full disk |
B_READ_ONLY_DEVICE | EROFS | Write request on a read-only file system |
B_CROSS_DEVICE_LINK | EXDEV | Hard link across devices not allowed |
B_LINK_LIMIT | ELOOP | Nested links too deep |
B_BUSTED_PIPE | EPIPE | Pipe no longer functional. |
Code | Description |
---|---|
B_DUPLICATE_REPLY | A reply message has already been sent |
B_BAD_REPLY | The reply message is inappropriate and can't be sent |
B_BAD_HANDLER | The designated message handler isn't valid |
B_MESSAGE_TO_SELF | A thread is trying to send a message to itself |
B_ALREADY_RUNNING | The application can't be launched again |
B_LAUNCH_FAILED | The attempt to launch the application failed |
B_AMBIGUOUS_APP_LAUNCH | Odd things happening in app land |
B_UNKOWN_MIME_TYPE | Application signature unknown |
B_BAD_SCRIPT_SYNTAX | Script syntax malformed |
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_EXECUTABLE | An executable image was expected |
B_BAD_ADDRESS | Illegal address. |
Code | Description |
---|---|
B_STREAM_NOT_FOUND | The attempt to locate the stream failed |
B_SERVER_NOT_FOUND | The attempt to locate the server failed |
B_RESOURCE_NOT_FOUND | The attempt to locate the resource failed |
B_RESOURCE_UNAVAILABLE | Permission to access the resource was denied |
B_BAD_SUBSCRIBER | The BSubscriber is invalid. |
B_SUBSCRIBER_NOT_ENTERED | The BSubscriber hasn't entered the stream |
B_BUFFER_NOT_AVAILABLE | The attempt to acquire the buffer failed. |
Code | Description |
---|---|
B_MAIL_NO_DAEMON | mail_daemon not running |
B_MAIL_UNKNOWN_USER | User unknown |
B_MAIL_WRONG_PASSWORD | Password doesn't match user |
B_MAIL_UNKNOWN_HOST | POP or SMTP host unrecognized |
B_MAIL_ACCESS_ERROR | Couldn't access host |
B_MAIL_UNKNOWN_FIELD | Unrecognized message field name |
B_MAIL_NO_RECIPIENT | Return to sender, address unknown |
B_MAIL_INVALID_MAIL | Invalid mail invalid mail invalid |
The Be Book, in lovely HTML, for BeOS Release 4.
Copyright © 1998 Be, Inc. All rights reserved.
Last modified November 10, 1998.