21 static inline herr_t
stackWalk(
unsigned n,
const H5E_error2_t* err_desc,
void* client_data) {
22 auto** e_iter =
static_cast<ExceptionType**
>(client_data);
25 const char* major_err = detail::nothrow::h5e_get_major(err_desc->maj_num);
26 const char* minor_err = detail::nothrow::h5e_get_minor(err_desc->min_num);
28 std::ostringstream oss;
29 oss <<
'(' << major_err <<
") " << minor_err;
31 detail::nothrow::h5_free_memory((
void*) major_err);
32 detail::nothrow::h5_free_memory((
void*) minor_err);
34 auto* e =
new ExceptionType(oss.str());
35 e->_err_major = err_desc->maj_num;
36 e->_err_minor = err_desc->min_num;
37 (*e_iter)->_next.reset(e);
43 [[noreturn]]
static inline void ToException(
const std::string& prefix_msg) {
44 hid_t err_stack = H5Eget_current_stack();
47 ExceptionType* e_iter = &e;
49 detail::nothrow::h5e_walk2(err_stack,
53 detail::nothrow::h5e_clear2(err_stack);
55 const char* next_err_msg = (e.nextException() != NULL) ? (e.nextException()->what())
58 e.setErrorMsg(prefix_msg +
" " + next_err_msg);
62 throw ExceptionType(prefix_msg +
": Unknown HDF5 error");