utils/kp_error.h File Reference

#include "kp_bool.h"
#include "kp_errors_define_decl.txt"

Go to the source code of this file.

Defines

#define ERROR_UNKNOWN_TEXT   "Unknown error."
 Text for unknown error.
#define KP_ERROR_DECLARATION(enum_code_decl, code_value, error_text)   enum_code_decl code_value,
#define KP_ERROR_DECLARATION_LAST(enum_code_decl, code_value, error_text)   enum_code_decl code_value

Enumerations

enum  kp_errors
 Enum with error codes. More...

Functions

 KP_ERROR_DECLARATION (ERROR_INCORRECT_PROPERTY_VALUE,,"Incorrect property value(incorrect value type).") KP_ERROR_DECLARATION(ERROR_INCORRECT_PROPLIST
Property list has incorrect data (properties)." )
int set_error (int error_code)
 Sets code of error.
int get_error_code ()
 Return code of error.
int get_error_code_and_reset ()
 Return code of error and reset error.
const char * get_error_text ()
 Return error message.
char * get_error_text_and_reset ()
 Return error message and reset error.
const char * get_error_text_by_code (int error_code)
 Gets error message by error code.
int reset_error ()
 Sets code of error equals 0 (no errors) and message equals empty string.


Define Documentation

#define ERROR_UNKNOWN_TEXT   "Unknown error."

Text for unknown error.

#define KP_ERROR_DECLARATION ( enum_code_decl,
code_value,
error_text   )     enum_code_decl code_value,

#define KP_ERROR_DECLARATION_LAST ( enum_code_decl,
code_value,
error_text   )     enum_code_decl code_value


Enumeration Type Documentation

enum kp_errors

Enum with error codes.


Function Documentation

Property list has incorrect kp_errors::data ( properties   ) 

int get_error_code (  ) 

Return code of error.

Returns:
code of error.

int get_error_code_and_reset (  ) 

Return code of error and reset error.

Returns:
code of error.

const char* get_error_text (  ) 

Return error message.

Returns:
error description.

char* get_error_text_and_reset (  ) 

Return error message and reset error.

Return error message and reset error. You need free message text after using.

Returns:
error description.

const char* get_error_text_by_code ( int  error_code  ) 

Gets error message by error code.

Parameters:
error_code code of error.
Returns:
error description.

kp_errors::KP_ERROR_DECLARATION ( ERROR_INCORRECT_PROPERTY_VALUE  ,
"Incorrect property value(incorrect value type)."   
)

int reset_error (  ) 

Sets code of error equals 0 (no errors) and message equals empty string.

Returns:
ERROR_NO code (equals 0), usefull for end function, if no errors (return reset_error()).

int set_error ( int  error_code  ) 

Sets code of error.

Parameters:
error_code code of error.
Returns:
given error code(usefull for end of function: return set_error(code))


doxygen