FileIException: Getting sensible error message

Hi,

I am using HDF5 as the file format in my application. I wonder how I can get a good error message for the following case: If I write to a location where I don’t have permission (e.g. / in Linux), which I do via

try {
_file = H5File(filename,p);
}
catch( FileIException error ) {
… handle error here
}
I get the following error:

HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) thread 140736607545088:
#000: …/…/…/src/H5F.c line 491 in H5Fcreate(): unable to create file
major: File accessibilty
minor: Unable to open file
#001: …/…/…/src/H5Fint.c line 1111 in H5F_open(): unable to open file: time = Mon Jan 13 14:13:36 2020
, name = ‘/2020-01-13.dld8’, tent_flags = 13
major: File accessibilty
minor: Unable to open file
#002: …/…/…/src/H5FD.c line 812 in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#003: …/…/…/src/H5FDsec2.c line 348 in H5FD_sec2_open(): unable to open file: name = ‘/2020-01-13.dld8’, errno = 13, error message = ‘Permission denied’, flags = 13, o_flags = 242
major: File accessibilty
minor: Unable to open file

So obviously the permission was denied. How can I get the “Unable to open file” and “permission denied” strings from my FileIException so I can use them in an error message I send back to the user?