Error Handling and Debugging Utility
This chapter describes APIs of the utility for error handling and debugging processing.
1. PFM_ERR
Records error information in a log file of the server.
-
Prototype
void PFM_ERR(char *format, …);
-
Parameters
Parameter Description *format
Output format.
…
Whether there is an input or not (optional).
-
Example
PFM_ERR("ERROR MESSAGE=%s", pfmStrGetErrorMsg());
2. PFM_DBG
Records debugging information in a log file of the server.
-
Prototype
void PFM_DBG(char *format, …);
-
Parameters
Parameter Description *format
Output format.
…
Whether there is an input or not (optional).
-
Example
Long a = 123; PFM_DBG("a=%ld", a);
3. PFM_TRY
Records trace log for a function before and after the function is called. If an error occurs during the function call, it goes to the PFM_CATCH label.
-
Prototype
void PFM_TRY(rc);
-
Parameters
Parameter Description rc
Function name to trace.
-
Example
char str[] = "2315"; long num, rc; PFM_TRY( pfmStrToLong(&num, str) ); return RC_NRM; PFM_CATCH: PFM_ERR("Error!!"); return rc;
4. PFM_TRYNJ
Records trace log for a function before and after the function is called. Unlike PFM_TRY, if an error occurs during the function call, it does not go to the PFM_CATCH label.
-
Prototype
void PFM_TRYNJ(rc);
-
Parameters
Parameter Description rc
Function name to trace.
-
Example
char str[] = "2315"; long num, rc; PFM_TRYNJ( pfmStrToLong(&num, str) ); If ( rc != RC_NRM ) { PFM_ERR("Error!!"); return rc; } return RC_NRM;