39 lines
1.4 KiB
C
39 lines
1.4 KiB
C
|
|
/**
|
||
|
|
* @file error.c
|
||
|
|
* @brief Implements the error subsystem: claims and names the akbasic status band.
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <akerror.h>
|
||
|
|
|
||
|
|
#include <akbasic/error.h>
|
||
|
|
|
||
|
|
akerr_ErrorContext *akbasic_error_register(void)
|
||
|
|
{
|
||
|
|
PREPARE_ERROR(errctx);
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Claim the whole band before naming anything in it: libakerror refuses a
|
||
|
|
* name for a status we do not own. Any collision propagates to the caller --
|
||
|
|
* another component owning part of our range is an initialization failure,
|
||
|
|
* not a warning.
|
||
|
|
*/
|
||
|
|
PASS(errctx, akerr_reserve_status_range(AKBASIC_ERR_BASE,
|
||
|
|
AKBASIC_ERR_LIMIT - AKBASIC_ERR_BASE,
|
||
|
|
AKBASIC_OWNER));
|
||
|
|
PASS(errctx, akerr_register_status_name(AKBASIC_OWNER, AKBASIC_ERR_SYNTAX,
|
||
|
|
"Syntax Error"));
|
||
|
|
PASS(errctx, akerr_register_status_name(AKBASIC_OWNER, AKBASIC_ERR_TYPE,
|
||
|
|
"Type Error"));
|
||
|
|
PASS(errctx, akerr_register_status_name(AKBASIC_OWNER, AKBASIC_ERR_UNDEFINED,
|
||
|
|
"Undefined Reference"));
|
||
|
|
PASS(errctx, akerr_register_status_name(AKBASIC_OWNER, AKBASIC_ERR_BOUNDS,
|
||
|
|
"Out Of Bounds"));
|
||
|
|
PASS(errctx, akerr_register_status_name(AKBASIC_OWNER, AKBASIC_ERR_ENVIRONMENT,
|
||
|
|
"Environment Error"));
|
||
|
|
PASS(errctx, akerr_register_status_name(AKBASIC_OWNER, AKBASIC_ERR_VALUE,
|
||
|
|
"Value Error"));
|
||
|
|
PASS(errctx, akerr_register_status_name(AKBASIC_OWNER, AKBASIC_ERR_STATE,
|
||
|
|
"State Error"));
|
||
|
|
SUCCEED_RETURN(errctx);
|
||
|
|
}
|