Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Functions
afw_error.h File Reference

Adaptive Framework error handling header. More...

#include "afw_interface.h"
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  afw_error_context_s
 Adaptive Framework Error Context. More...
 
struct  afw_error_s
 Adaptive Framework Error. More...
 
struct  afw_error_footprint_s
 error footprint More...
 
struct  afw_try_s
 

Macros

#define AFW_ERROR_RV_SOURCE_ID_Z_NULL   NULL
 Not applicable rv source id.
 
#define AFW_ERROR_RV_SOURCE_ID_Z_apr   "apr"
 APR rv source id. More...
 
#define AFW_ERROR_RV_SOURCE_ID_Z_icu   "icu"
 ICU rv source id. More...
 
#define AFW_ERROR_CLEAR_PARTIAL(__ERROR_)
 
#define AFW_ERROR_FOOTPRINT(_footprint_)
 Set error footprint. More...
 
#define AFW_THROW_UNHANDLED_ERROR(unhandled_error, _ERROR, _CODE, _RV_SOURCE_ID, _RV, _MESSAGE_Z)
 
#define AFW_SUCCESS(__ERROR_)   ((__ERROR_)->code == afw_error_code_none)
 
#define AFW_ERROR_OCCURRED(__ERROR_)   ((__ERROR_)->code != afw_error_code_none)
 
#define AFW_THROW(xctx)    longjmp(((xctx)->current_try->throw_jmp_buf), (xctx)->error->code)
 
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
 Macro used to set error and 0 rv in xctx and throw it. More...
 
#define AFW_THROW_ERROR_RV_Z(code, rv_source_id, rv, message_z, xctx)
 Macro used to set error and rv in xctx and throw it. More...
 
#define AFW_THROW_ERROR_FZ(code, xctx, format_z, ...)
 Macro used to set error and 0 rv in xctx and throw it. More...
 
#define AFW_THROW_ERROR_RV_FZ(code, rv_source_id, rv, xctx, format_z, ...)
 Macro used to set error and rv in xctx and throw it. More...
 
#define AFW_THROW_ERROR_VZ(code, format_z, ap, xctx)
 Macro used to set error and 0 rv in xctx and throw it. More...
 
#define AFW_THROW_ERROR_RV_VZ(code, rv_source_id, rv, format_z, ap, xctx)
 Macro used to set error and rv in xctx and throw it. More...
 
#define AFW_THROW_ERROR_FOOTPRINT_Z(code, message_z, xctx)
 Macro used to set error and 0 rv in xctx using line number in footprint then throw it. More...
 
#define AFW_THROW_ERROR_FOOTPRINT_RV_Z(code, rv_source_id, rv, message_z, xctx)
 Macro used to set error and rv in xctx using line number in footprint then throw it. More...
 
#define AFW_THROW_ERROR_FOOTPRINT_FZ(code, xctx, format_z, ...)
 Macro used to set error and 0 rv in xctx using line number in footprint then throw it. More...
 
#define AFW_THROW_ERROR_FOOTPRINT_RV_FZ(code, rv_source_id, rv, xctx, format_z, ...)
 Macro used to set error and rv in xctx using line number in footprint then throw it. More...
 
#define AFW_THROW_ERROR_FOOTPRINT_VZ(code, format_z, ap, xctx)
 Macro used to set error and 0 rv in xctx using line number in footprint then throw it. More...
 
#define AFW_THROW_ERROR_FOOTPRINT_RV_VZ(code, rv_source_id, rv, format_z, ap, xctx)
 Macro used to set error and rv in xctx using line number in footprint then throw it. More...
 
#define AFW_THROW_MEMORY_ERROR(xctx)
 
#define AFW_ERROR_INTERNAL_ON_UNHANDLED(__TRY_)
 
#define AFW_ERROR_COPY(to, from)
 Copy an error struct. More...
 
#define AFW_ERROR_THROWN   ((const afw_error_t *)&this_THROWN_ERROR)
 Access the thrown error. See AFW_TRY. More...
 
#define AFW_TRY
 Begin an AFW TRY block. More...
 
#define AFW_CATCH(__CODE_)
 Catch a particular error that occurs in a AFW_TRY block. More...
 
#define AFW_CATCH_UNHANDLED
 Catch an unhandled error that occurs in a AFW_TRY block. More...
 
#define AFW_FINALLY
 Always executed regardless of error. More...
 
#define AFW_ENDTRY
 Ends an AFW try block. More...
 
#define AFW_MARK_UNHANDLED
 Use in an AFW_CATCH or AFW_CATCH_UNHANDLED block to mark error as unhandled and break. More...
 
#define afw_error_source_file(error)    afw_utf8_z_source_file((error)->source_z)
 Returns value of error->source_z after last '/ 'or '\'. More...
 

Typedefs

typedef struct afw_error_footprint_s afw_error_footprint_t
 error footprint More...
 

Functions

void afw_error_rv_set_z (afw_error_code_t code, const afw_utf8_z_t *rv_source_id_z, int related_rv, const afw_utf8_z_t *source_z, const afw_utf8_z_t *message_z, afw_xctx_t *xctx)
 
void afw_error_set_z (afw_error_code_t code, const afw_utf8_z_t *source_z, const afw_utf8_z_t *message_z, afw_xctx_t *xctx)
 
void afw_error_rv_set_fz (afw_error_code_t code, const afw_utf8_z_t *rv_source_id_z, int related_rv, const afw_utf8_z_t *source_z, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...)
 
void afw_error_set_fz (afw_error_code_t code, const afw_utf8_z_t *source_z, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...)
 
void afw_error_rv_set_vz (afw_error_code_t code, const afw_utf8_z_t *rv_source_id_z, int related_rv, const afw_utf8_z_t *source_z, const afw_utf8_z_t *format_z, va_list ap, afw_xctx_t *xctx)
 
void afw_error_set_vz (afw_error_code_t code, const afw_utf8_z_t *source_z, const afw_utf8_z_t *format_z, va_list ap, afw_xctx_t *xctx)
 
const afw_object_tafw_error_to_object (const afw_error_t *error, const afw_pool_t *p, afw_xctx_t *xctx)
 Create an object with error info in specified pool. More...
 
void afw_error_add_to_object (const afw_object_t *object, const afw_error_t *error, afw_xctx_t *xctx)
 Add error info to existing object using specified pool. More...
 
afw_boolean_t afw_error_allow_in_response (afw_error_code_t code)
 Determine if the error object for code is allowed in HTTP response. More...
 
int afw_error_print (FILE *fp, const afw_error_t *error)
 Print error. More...
 
int afw_error_print_with_xctx (FILE *fp, const afw_error_t *error, const afw_pool_t *p, afw_xctx_t *xctx)
 Print error when xctx is available. More...
 
void afw_error_write_log (afw_log_priority_t priority, const afw_error_t *error, afw_xctx_t *xctx)
 Write error to environment log. More...
 
const afw_utf8_z_tafw_error_message (afw_xctx_t *xctx, const afw_utf8_z_t *format,...)
 Build message in xctx error message_wa and return pointer. More...
 
const afw_utf8_z_tafw_error_message_vz (const afw_utf8_z_t *format, va_list ap, afw_xctx_t *xctx)
 Build message in xctx error message_wa and return pointer. More...
 
 afw_error_http_status (const afw_error_t *error)
 Returns http status for error. More...
 
const afw_utf8_z_tafw_error_code_id_z (const afw_error_t *error)
 Returns error->code id. More...
 
const afw_utf8_tafw_error_to_utf8 (const afw_error_t *error, const afw_pool_t *p, afw_xctx_t *xctx)
 Convert error to utf8. More...
 

Detailed Description

Adaptive Framework error handling header.

Definition in file afw_error.h.