libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_error.h File Reference

Go to the source code of this file.

Data Structures

struct  GblErrorDomain
 
struct  GblError
 

Macros

#define GBL_ERROR_DOMAIN
 
#define GBL_ERROR_MESSAGE_SIZE
 

Functions

const GblErrorDomaingblErrorDomain (void)
 
Accessors

Methods for accessing errors and their state

const GblErrorGblError_pending (void)
 
GblQuark GblError_domain (void)
 
const char * GblError_string (void)
 
Management

Methods for managing pending errors

GblBool GblError_clear (void)
 
GblBool GblError_lower (GblError *pSelf)
 
const GblErrorGblError_raise (const char *pFile, const char *pFunction, size_t line, const GblErrorDomain *pDomain, GblEnum code, const char *pFmt,...)
 
const GblErrorGblError_raisev (const char *pFile, const char *pFunction, size_t line, const GblErrorDomain *pDomain, GblEnum code, const char *pFmt, va_list varArgs)
 
const GblErrorGblError_reraise (const char *pFile, const char *pFunction, size_t line)
 

Detailed Description

GblError thread-local generic error code.

This file contains the public API for GblError, which is a structure used to represent a single pending error status for a single thread.

Author
2023 Falco Girgis

Definition in file gimbal_error.h.

Macro Definition Documentation

◆ GBL_ERROR_DOMAIN

#define GBL_ERROR_DOMAIN

Builtin standard error domain.

Definition at line 17 of file gimbal_error.h.

◆ GBL_ERROR_MESSAGE_SIZE

#define GBL_ERROR_MESSAGE_SIZE

Size of the GblError::message string.

Definition at line 18 of file gimbal_error.h.

Function Documentation

◆ GblError_pending()

const GblError * GblError_pending ( void  )

Returns a pointer to the current thread's pending error or NULL.

◆ GblError_domain()

GblQuark GblError_domain ( void  )

Returns GblQuark of the name of the current thread's pending error domain.

◆ GblError_string()

const char * GblError_string ( void  )

Returns the stringified version of the current thread's pending error code.

◆ GblError_clear()

GblBool GblError_clear ( void  )

Clears the current thread's pending error, returning GBL_TRUE if there was a pending error.

◆ GblError_lower()

GblBool GblError_lower ( GblError pSelf)

Equivalent to GblError_clear(), except the pending error is copied into the destination buffer.

◆ GblError_raise()

const GblError * GblError_raise ( const char *  pFile,
const char *  pFunction,
size_t  line,
const GblErrorDomain pDomain,
GblEnum  code,
const char *  pFmt,
  ... 
)

Raises an error on the current thread with the given domain, code, and message.

◆ GblError_raisev()

const GblError * GblError_raisev ( const char *  pFile,
const char *  pFunction,
size_t  line,
const GblErrorDomain pDomain,
GblEnum  code,
const char *  pFmt,
va_list  varArgs 
)

Equivalent to GblError_raise(), except the additional args are passed via a va_list.

◆ GblError_reraise()

const GblError * GblError_reraise ( const char *  pFile,
const char *  pFunction,
size_t  line 
)

Reraises the current thread's pending error, updating its source context.

◆ gblErrorDomain()

const GblErrorDomain * gblErrorDomain ( void  )

Returns the builtin error domain used by GBL_RESULT.