151#define bj_error_code_kind(code) ((code) & 0x000000FFu)
163#define bj_error_code_is_user(code) (((code) >> 24) & 0xFFu)
General-purpose definitions for Banjo API.
struct bj_error bj_error
Definition api.h:275
#define BANJO_EXPORT
Definition api.h:106
uint32_t bj_bool
Boolean type used throughout the Banjo API.
Definition api.h:200
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.
Definition error.h:89
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.
Definition error.h:95
@ BJ_ERROR_CANNOT_ALLOCATE
Memory allocation failed.
Definition error.h:107
@ BJ_ERROR_FILE_NOT_FOUND
Requested file was not found.
Definition error.h:105
@ BJ_ERROR_CANNOT_READ
Error while reading from a file or stream.
Definition error.h:117
@ BJ_ERROR_CANNOT_WRITE
Error while writing to a file or stream.
Definition error.h:119
@ BJ_ERROR_DISPOSE
System component cleanup failed.
Definition error.h:111
@ BJ_ERROR_SYSTEM
Generic operating system error.
Definition error.h:103
@ BJ_ERROR_NONE
No error occurred.
Definition error.h:91
@ BJ_ERROR_INCORRECT_VALUE
Value does not match expected value.
Definition error.h:127
@ BJ_ERROR_UNSUPPORTED
Operation not supported on this platform or configuration.
Definition error.h:97
@ BJ_ERROR_INVALID_DATA
Generic invalid data error.
Definition error.h:123
@ BJ_ERROR_NOT_IMPLEMENTED
Feature not yet implemented.
Definition error.h:99
@ BJ_ERROR_VIDEO
Error in video/graphics subsystem.
Definition error.h:131
@ BJ_ERROR_AUDIO
Error in audio subsystem.
Definition error.h:135
@ BJ_ERROR_INVALID_FORMAT
Data format does not match expected format.
Definition error.h:125
@ BJ_ERROR_IO
Generic I/O error.
Definition error.h:115
@ BJ_ERROR_INITIALIZE
System component initialization failed.
Definition error.h:109