Initializing help system before first use

XPRBdefcberr

XPRBdefcberr


Purpose
Callback for user error handling.
Synopsis
int XPRBdefcberr(XPRBprob prob, void (XPRB_CC *usererr)(XPRBprob my_prob, void *my_object, int errnum, int type, const char *errtext), void *object);
Arguments
prob 
Reference to a problem.
usererr 
The user's error handling function.
my_prob 
Problem pointer passed to the callback function.
my_object 
User-defined object passed to the callback function.
errnum 
The error number.
type 
Type of the error. This will be one of:
XPRB_ERR 
fatal error;
XPRB_WAR 
warning.
errtext 
Text of the error message.
object 
User-defined object to be passed to the callback function.
Return value
0 if function executed successfully, 1 otherwise.
Example
In this example a function is defined for displaying errors and exiting if they are suitably severe. This function is then set as the error-handling callback.
XPRBprob prob;
   ...
void myerr(XPRBprob my_prob, void *my_object, int num, int type,
           const char *t)
{
  printf("BCL error %d: %s\n", num, t);
  if(type == XPRB_ERR) exit(0);
}
   ...
XPRBdefcberr(prob, myerror, NULL);
Further information
1. This function defines the error handling callback that returns the error number and text of error messages and warnings produced by BCL for a given problem. A list of BCL error messages with some explanations can be found in the Appendix BCL error messages of this manual. If printing of error or warning messages is enabled (see XPRBsetmsglevel) these are printed after the call to this function.
2. It is recommended to define this callback function if the error handling by BCL is disabled (for instance in BCL programs integrated into larger applications or in BCL programs executed under Windows). Alternatively it is of course possible to test the return values of all BCL functions. However, the callback provides more detailed information about the type of error that has occurred.
3. This function may be used before any problems have been created and even before BCL has been initialized (with first argument NULL). In this case the error handling function set by this callback applies to all problems that are created subsequently. If this function is called after the creation of a problem, then the version without problem pointer will only influence the global BCL error handling settings, to change the settings for the specific problem you need to use the problem as its first argument. Global error handling settings apply to all cases of errors where no problem information is known, for example in the case of a missing/uninitialized model object used as argument to certain BCL functions.
Related topics

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.