Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2025-11-11 The HDF5 Field Guide

- Main Page
- Getting started
- User Guide
- Reference Manual
- Cookbook
- Technical Notes
- RFCs
- Specifications
- Glossary
- Full-Text Search
- About

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
H5Epublic.h File Reference
`#include <stdio.h>`
`#include "H5public.h"`
`#include "H5Ipublic.h"`
`#include "H5Epubgen.h"`

## Data Structures
struct | H5E_error1_t
struct | H5E_error2_t

## Macros
#define | H5E_BEGIN_TRY
#define | H5E_DEFAULT 0 /* (hid_t) */
#define | H5E_END_TRY
#define | H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g)
#define | H5Epush_goto(func, cls, maj, min, str, label)
#define | H5Epush_ret(func, cls, maj, min, str, ret)
#define | H5Epush_sim(func, cls, maj, min, str)

## Typedefs
typedef herr_t(* | H5E_auto1_t) (void *client_data)
| Callback function for H5Eset_auto1()
typedef herr_t(* | H5E_auto2_t) (hid_t estack, void *client_data)
| Callback function for H5Eset_auto2()
typedef hid_t | H5E_major_t
typedef hid_t | H5E_minor_t
typedef herr_t(* | H5E_walk1_t) (int n, H5E_error1_t *err_desc, void *client_data)
| Callback function for H5Ewalk1()
typedef herr_t(* | H5E_walk2_t) (unsigned n, const H5E_error2_t *err_desc, void *client_data)
| Callback function for H5Ewalk2()

## Enumerations
enum | H5E_direction_t { H5E_WALK_UPWARD = 0 , H5E_WALK_DOWNWARD = 1 }
enum | H5E_type_t { H5E_MAJOR , H5E_MINOR }

## Functions
herr_t | H5Eappend_stack (hid_t dst_stack_id, hid_t src_stack_id, bool close_source_stack)
| Appends one error stack to another, optionally closing the source stack.
herr_t | H5Eauto_is_v2 (hid_t err_stack, unsigned *is_stack)
| Determines the type of error stack.
herr_t | H5Eclear1 (void)
| Clears the error stack for the current thread.
herr_t | H5Eclear2 (hid_t err_stack)
| Clears the specified error stack or the error stack for the current thread.
herr_t | H5Eclose_msg (hid_t err_id)
| Closes an error message.
herr_t | H5Eclose_stack (hid_t stack_id)
| Closes an error stack handle.
hid_t | H5Ecreate_msg (hid_t cls, H5E_type_t msg_type, const char *msg)
| Adds a major or minor error message to an error class.
hid_t | H5Ecreate_stack (void)
| Creates a new, empty error stack.
herr_t | H5Eget_auto1 (H5E_auto1_t *func, void **client_data)
| Returns the current settings for the automatic error stack traversal function and its data.
herr_t | H5Eget_auto2 (hid_t estack_id, H5E_auto2_t *func, void **client_data)
| Returns the settings for the automatic error stack traversal function and its data.
ssize_t | H5Eget_class_name (hid_t class_id, char *name, size_t size)
| Retrieves error class name.
hid_t | H5Eget_current_stack (void)
| Returns a copy of the current error stack.
char * | H5Eget_major (H5E_major_t maj)
| Returns a character string describing an error specified by a major error number.
char * | H5Eget_minor (H5E_minor_t min)
| Returns a character string describing an error specified by a minor error number.
ssize_t | H5Eget_msg (hid_t msg_id, H5E_type_t *type, char *msg, size_t size)
| Retrieves an error message.
ssize_t | H5Eget_num (hid_t error_stack_id)
| Retrieves the number of error messages in an error stack.
herr_t | H5Eis_paused (hid_t stack_id, bool *is_paused)
| Check if pushing errors on an error stack is paused
herr_t | H5Epause_stack (hid_t stack_id)
| Pause pushing errors on an error stack
herr_t | H5Epop (hid_t err_stack, size_t count)
| Deletes specified number of error messages from the error stack.
herr_t | H5Eprint1 (FILE *stream)
| Prints the current error stack in a default manner.
herr_t | H5Eprint2 (hid_t err_stack, FILE *stream)
| Prints the specified error stack in a default manner.
herr_t | H5Epush1 (const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str)
| Pushes a new error record onto the error stack.
herr_t | H5Epush2 (hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg,...)
| Pushes a new error record onto an error stack.
hid_t | H5Eregister_class (const char *cls_name, const char *lib_name, const char *version)
| Registers a client library or application program to the HDF5 error API.
herr_t | H5Eresume_stack (hid_t stack_id)
| Resume pushing errors on an error stack
herr_t | H5Eset_auto1 (H5E_auto1_t func, void *client_data)
| Turns automatic error printing on or off.
herr_t | H5Eset_auto2 (hid_t estack_id, H5E_auto2_t func, void *client_data)
| Turns automatic error printing on or off.
herr_t | H5Eset_current_stack (hid_t err_stack_id)
| Replaces the current error stack.
herr_t | H5Eunregister_class (hid_t class_id)
| Removes an error class.
herr_t | H5Ewalk1 (H5E_direction_t direction, H5E_walk1_t func, void *client_data)
| Walks the current error stack, calling the specified function.
herr_t | H5Ewalk2 (hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data)
| Walks the specified error stack, calling the specified function.

## Variables
hid_t | H5E_ERR_CLS_g

## Macro Definition Documentation

## ◆ H5E_BEGIN_TRY

#define H5E_BEGIN_TRY

Value:
{ \
unsigned H5E_saved_is_v2; \
union { \
H5E_auto1_t efunc1; \
H5E_auto2_t efunc2; \
} H5E_saved; \
void *H5E_saved_edata; \
\
(void)H5Eauto_is_v2(H5E_DEFAULT, &H5E_saved_is_v2); \
if (H5E_saved_is_v2) { \
(void)H5Eget_auto2(H5E_DEFAULT, &H5E_saved.efunc2, &H5E_saved_edata); \
(void)H5Eset_auto2(H5E_DEFAULT, NULL, NULL); \
} \
else { \
(void)H5Eget_auto1(&H5E_saved.efunc1, &H5E_saved_edata); \
(void)H5Eset_auto1(NULL, NULL); \
}
H5E_auto2_t
herr_t(* H5E_auto2_t)(hid_t estack, void *client_data)
Callback function for H5Eset_auto2()
Definition H5Epublic.h:191
H5E_auto1_t
herr_t(* H5E_auto1_t)(void *client_data)
Callback function for H5Eset_auto1()
Definition H5Epublic.h:785
H5E_DEFAULT
#define H5E_DEFAULT
Definition H5Epublic.h:25
H5Eauto_is_v2
herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack)
Determines the type of error stack.
H5Eget_auto1
herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data)
Returns the current settings for the automatic error stack traversal function and its data.
H5Eget_auto2
herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
Returns the settings for the automatic error stack traversal function and its data.
H5Eset_auto1
herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data)
Turns automatic error printing on or off.
H5Eset_auto2
herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
Turns automatic error printing on or off.

## ◆ H5E_DEFAULT

#define H5E_DEFAULT 0 /* (hid_t) */

Value for the default error stack

Since
  1.12.2

## ◆ H5E_END_TRY

#define H5E_END_TRY

Value:
if (H5E_saved_is_v2) \
(void)H5Eset_auto2(H5E_DEFAULT, H5E_saved.efunc2, H5E_saved_edata); \
else \
(void)H5Eset_auto1(H5E_saved.efunc1, H5E_saved_edata); \
}

## ◆ H5E_ERR_CLS

#define H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g)

## ◆ H5Epush_goto

#define H5Epush_goto | ( |  | func,
|  |  | cls,
|  |  | maj,
|  |  | min,
|  |  | str,
|  |  | label )

Value:
do { \
H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, cls, maj, min, str); \
goto label; \
} while (0)

## ◆ H5Epush_ret

#define H5Epush_ret | ( |  | func,
|  |  | cls,
|  |  | maj,
|  |  | min,
|  |  | str,
|  |  | ret )

Value:
do { \
H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, cls, maj, min, str); \
return (ret); \
} while (0)

## ◆ H5Epush_sim

#define H5Epush_sim | ( |  | func,
|  |  | cls,
|  |  | maj,
|  |  | min,
|  |  | str )

Value:
H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, cls, maj, min, str)
H5Epush2
herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg,...)
Pushes a new error record onto an error stack.

## Typedef Documentation

## ◆ H5E_auto1_t

typedef herr_t(* H5E_auto1_t) (void *client_data)

Callback function for H5Eset_auto1()

Parameters

  [in] | client_data | Pointer to client data in the format expected by the user-defined function

Returns
  Returns a non-negative value if successful; otherwise, returns a negative value.

Since
  1.0.0

## ◆ H5E_auto2_t

typedef herr_t(* H5E_auto2_t) (hid_t estack, void *client_data)

Callback function for H5Eset_auto2()

Parameters

  [in] | estack | Error stack identifier
  [in] | client_data | Pointer to client data in the format expected by the user-defined function

Returns
  Returns a non-negative value if successful; otherwise, returns a negative value.

Since
  1.8.0

## ◆ H5E_major_t

typedef hid_t H5E_major_t

## ◆ H5E_minor_t

typedef hid_t H5E_minor_t

## ◆ H5E_walk1_t

typedef herr_t(* H5E_walk1_t) (int n, H5E_error1_t *err_desc, void *client_data)

Callback function for H5Ewalk1()

Parameters

  [in] | n | Indexed error position in the stack
  [in] | err_desc | Pointer to a data structure describing the error
  [in] | client_data | Pointer to client data in the format expected by the user-defined function

Returns
  Returns a non-negative value if successful; otherwise, returns a negative value.

Since
  1.0.0

## ◆ H5E_walk2_t

typedef herr_t(* H5E_walk2_t) (unsigned n, const H5E_error2_t *err_desc, void *client_data)

Callback function for H5Ewalk2()

Parameters

  [in] | n | Indexed error position in the stack
  [in] | err_desc | Pointer to a data structure describing the error
  [in] | client_data | Pointer to client data in the format expected by the user-defined function

Returns
  Returns a non-negative value if successful; otherwise, returns a negative value.

Since
  1.8.0

## Enumeration Type Documentation

## ◆ H5E_direction_t

enum H5E_direction_t

Error stack traversal direction

Enumerator
H5E_WALK_UPWARD | begin w/ most specific error, end at API function
H5E_WALK_DOWNWARD | begin at API function, end w/ most specific error

## ◆ H5E_type_t

enum H5E_type_t

Different kinds of error information

Enumerator
H5E_MAJOR |
H5E_MINOR |

## Variable Documentation

## ◆ H5E_ERR_CLS_g

hid_t H5E_ERR_CLS_g
| extern