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_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 aresynonyms 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, which is 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's not 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_VALUES | 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/EWOULDBLOCK | But you don't want to |
B_ERROR = -1 | A convenient catchall for general errors | |
B_NO_ERROR = 0 | Everything's OK | |
B_OK | Same as B_NO_ERROR |
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 |
Code |
---|
B_DEV_INVALID_IOCTL |
B_DEV_NO_MEMORY |
B_DEV_BAD_DRIVE_NUM |
B_DEV_NO_MEDIA |
B_DEV_UNREADABLE |
B_DEV_FORMAT_ERROR |
B_DEV_TIMEOUT |
B_DEV_RECALIBRATE_ERROR |
B_DEV_SEEK_ERROR |
B_DEV_ID_ERROR |
B_DEV_READ_ERROR |
B_DEV_WRITE_ERROR |
B_DEV_NOT_READY |
B_DEV_MEDIA_CHANGED |
The Be Book, in lovely HTML, for the BeOS Preview Release.
Copyright © 1997 Be, Inc. All rights reserved.
Be is a registered trademark; BeOS, BeBox, BeWare, GeekPort, the Be logo, and the BeOS logo are trademarks of Be, Inc.
Last modified June 30, 1997.