Banjo API 0.0.1
Multi-purpose C99 API
Loading...
Searching...
No Matches
error.h File Reference

Recoverable error handling.

#include <banjo/api.h>
#include <banjo/memory.h>
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bj_error
 Error structure. More...
 

Macros

#define bj_error_code_is_user   (c) (((c >> 24) & 0xFF) > 0x00)
 Checks if an error code is user-provided or Banjo.
 
#define bj_error_code_kind(c)
 Evaluates to an error code kind.
 
#define BJ_ERROR_MESSAGE_MAX_LEN   127
 Maximum number of characters an error message in bj_error can hold.
 

Enumerations

enum  bj_error_code {
  BJ_ERROR_NONE = 0x00000000 , BJ_ERROR = 0x00000001 , BJ_ERROR_UNSUPPORTED = 0x00000101 , BJ_ERROR_NOT_IMPLEMENTED = 0x00000201 ,
  BJ_ERROR_SYSTEM = 0x00000002 , BJ_ERROR_FILE_NOT_FOUND = 0x00000102 , BJ_ERROR_CANNOT_ALLOCATE = 0x00000202 , BJ_ERROR_INITIALIZE = 0x00000302 ,
  BJ_ERROR_DISPOSE = 0x00000302 , BJ_ERROR_IO = 0x00000003 , BJ_ERROR_CANNOT_READ_FILE = 0x00000103 , BJ_ERROR_INVALID_DATA = 0x00000004 ,
  BJ_ERROR_INVALID_FORMAT = 0x00000104 , BJ_ERROR_INCORRECT_VALUE = 0x00000204 , BJ_ERROR_VIDEO = 0x00000005 , BJ_ERROR_AUDIO = 0x00000006
}
 A numeric representation of an error in Banjo. More...
 

Functions

void bj_set_error (bj_error **p_error, uint32_t code, const char *message)
 Fills in a bj_error object with given code and message.
 
bj_bool bj_error_check (const bj_error *p_error, uint32_t code)
 Checks if the given error matches the error code.
 
bj_bool bj_forward_error (bj_error *p_source, bj_error **p_destination)
 Forward an error into another error location.
 
void bj_clear_error (bj_error **p_error)
 Clears the given error location.