FTAM/9000 Programmer's Guide

Chapter 9 345
Handling Errors
Example Program Checking for Errors
/*
** Call ft_gperror to get the printable strings for
** the return_code and vendor_code. Print the
** strings returned from ft_gperror.
*/
res = ft_gperror(& result, & return_string, & vendor_string, &
outcome);
if (res == SUCCESS) {
if (return_string != NULL) {
(void)printf(“FTAM failure: return_code = %s\n”, return_string);
res = ft_fdmemory(return_string, & outcome);
if (res != SUCCESS)
error_handler(outcome, ft_diag);
}
/*
** Print the vendor_code if it exists.
*/
if (vendor_string != NULL) {
(void)printf(“FTAM failure: vendor_code = %s\n”, vendor_string);
res = ft_fdmemory(vendor_string, & outcome);
if (res != SUCCESS)
error_handler(outcome, ft_diag);
}
}
/*
** Traverse the diagnostic list and print the further_details
strings.
*/
while(diag != NULL) {
(void)printf(“FTAM failure: diagnostic number = %d\n”,
diag->error_id);
if(diag->further_details != NULL)
(void)printf(“FTAM failure: diagnostic = %s\n”,
diag->further_details);
diag = diag->next;
}
exit(1);
}