#pragma once /************************************** * * class: e x c e p t i o n * ************************************** * * Functional description * * C++ exception handling class. Contains error category, code * and description. Depending on category and error * code user can get description what cause this error. * ERROR structure: * [node/server][component:err description][OS:error description] * example: * [127.0.0.1][DISK:can't open file: mytable.dat][REASON:access denied] * [127.0.0.1][CONN:can't init connection][REASON:too many active connections] **************************************/ class __declspec( dllexport ) node_exception { public: // constructors node_exception(char *_msg); node_exception(int icomp = 0, int icode = 0, int ios = 0,...); // copy constructor node_exception(const node_exception &e); void operator= (const node_exception &e); ~node_exception(); int comp; // ID of component, which generates the error int code; // code id of the error of the component int os; // OS error code char *msg; // final error message }; /************************************** * * structure: E R R O R _ I N F O * ************************************** * * Functional description * * Holds detailed information of the error **************************************/ struct ERROR_INFO { ERROR_INFO(char *_categ = 0, char *_format = 0, char *_reason = 0) { categ = _categ; reason = _reason; format = _format; }; char *categ; // name of the error category char *format; // error format string char *reason; // predefined error cause reason string. It may be generate as well from OS error code }; /************************************** * * interface: S e t E x c e p t i o n H a n d l e r * ************************************** * * Functional description * * callback interface per thread, which will be called * on the error. if interface is not set, the node_exception * exception will thronw **************************************/ void __declspec( dllexport ) __stdcall SetExceptionHandler(char *); /************************************** * * function: T h r o w E x c e p t i o n * ************************************** * * Functional description * * callback interface per thread, which will be called * on the error. if interface is not set, the node_exception * exception will thronw **************************************/ bool ThrowException(node_exception &e);