319#define bj_error_code_kind(code) ((code) & 0x000000FFu)
331#define bj_error_code_is_user(code) (((code) >> 24) & 0xFFu)
General-purpose definitions for Banjo API.
uint32_t bj_bool
Boolean type used throughout the Banjo API.
void bj_propagate_prefixed_error(struct bj_error **dest, struct bj_error *src, const char *format,...)
Propagates an error with an added prefix.
void bj_prefix_error(struct bj_error **error, const char *prefix)
Adds a prefix to an existing error's message.
const char * bj_error_message(const struct bj_error *error)
Gets the error message from an error object.
bj_bool bj_error_matches_kind(const struct bj_error *error, uint32_t kind)
Checks if an error belongs to a specific error kind (category).
struct bj_error * bj_copy_error(const struct bj_error *error)
Creates a copy of an error.
void bj_clear_error(struct bj_error **error)
Frees an error and sets the pointer to NULL.
void bj_propagate_error(struct bj_error **dest, struct bj_error *src)
Propagates an error to the caller's error location.
bj_error_code
A numeric representation of an error in Banjo.
void bj_set_error(struct bj_error **error, uint32_t code, const char *message)
Creates a new error with a literal message.
void bj_prefix_error_fmt(struct bj_error **error, const char *format,...)
Adds a formatted prefix to an existing error's message.
bj_bool bj_error_matches(const struct bj_error *error, uint32_t code)
Checks if an error matches a specific error code.
void bj_set_error_fmt(struct bj_error **error, uint32_t code, const char *format,...)
Creates a new error with a formatted message.
@ BJ_ERROR
General unspecified error.
@ BJ_ERROR_CANNOT_ALLOCATE
Memory allocation failed.
@ BJ_ERROR_FILE_NOT_FOUND
Requested file was not found.
@ BJ_ERROR_CANNOT_READ
Error while reading from a file or stream.
@ BJ_ERROR_CANNOT_WRITE
Error while writing to a file or stream.
@ BJ_ERROR_DISPOSE
System component cleanup failed.
@ BJ_ERROR_SYSTEM
Generic operating system error.
@ BJ_ERROR_NONE
No error occurred.
@ BJ_ERROR_NETWORK
Error in network subsystem.
@ BJ_ERROR_INCORRECT_VALUE
Value does not match expected value.
@ BJ_ERROR_UNSUPPORTED
Operation not supported on this platform or configuration.
@ BJ_ERROR_INVALID_DATA
Generic invalid data error.
@ BJ_ERROR_NOT_IMPLEMENTED
Feature not yet implemented.
@ BJ_ERROR_VIDEO
Error in video/graphics subsystem.
@ BJ_ERROR_AUDIO
Error in audio subsystem.
@ BJ_ERROR_NETWORK_SOCKET
Socket error.
@ BJ_ERROR_INVALID_FORMAT
Data format does not match expected format.
@ BJ_ERROR_NETWORK_TIMEOUT
Operation timed out.
@ BJ_ERROR_IO
Generic I/O error.
@ BJ_ERROR_INITIALIZE
System component initialisation failed.