Hi,
I wish to trap the cause of error messages rather than having them print to stderr and I figured that the best way of doing this was using a callback as outlined on this page:
http://www.hdfgroup.org/HDF5/doc/UG/13_ErrorHandling.html
However, there appears to be a relatively serious bug, either in the example or in the implementation of some of the H5E functions. In version 1.8.2 and 1.8.3 the calls to the H5Eget methods from the callback clear the error stack and so corrupt the contents of 'err_desc':
herr_t
custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data)
{
FILE *stream = (FILE *)client_data;
char maj[MSG_SIZE];
char min[MSG_SIZE];
char cls[MSG_SIZE];
const int indent = 4;
/* Get descriptions for the major and minor error numbers */
if(H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE)<0)
TEST_ERROR;
The above call results in the usage of FUNC_ENTER_API which clears the error stack that is currently being navigated:
ssize_t
H5Eget_class_name(hid_t class_id, char *name, size_t size)
{
H5E_cls_t *cls; /* Pointer to error class */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(H5Eget_class_name, FAIL)
Now that I understand the cause, I can change how I'm using the API, so that my walk function only "stores" the information passed in via the "err_desc" parameter, however, either the behaviour of "H5Eget_msg" needs to be changed, or at a minimum the example/documentation need to be updated appropriately.
Kind Regards,
Richard