Error Handling
Contents
Error Handling
The following classes are all defined within namespace HIPP::IO::H5.
ErrH5
-
class ErrH5 : public HIPP::ErrAppH5, public HIPP::ErrClassDefault
The exception thrown on the error of any HDF5 call.
-
typedef herr_t errno_t
-
typedef int flag_t
-
typedef ErrAppH5 err_app_t
-
typedef ErrClassDefault err_class_t
errno_tis the type of the error number hosted byErrH5.flat_tis the type of the static flag attribute which controls the behavior ofErrH5.err_app_t,err_class_tare the parent classes which define the structure of the exception model.
-
ErrH5(errno_t new_errno = -1) noexcept
The constructor.
By default, HDF5 oringinal library does not code the error by a single number, so the
new_errnois of no meaning.
-
virtual const char *what() const noexcept override
-
virtual string whats() const
These two functions report the detail of the exception instance.
what()only roughly indicates the error at application level, butwhats()returns more detailed information, including the info associated with thrown error number.
-
errno_t get_errno() const noexcept
-
void set_errno(errno_t new_errno) noexcept
get_errno()returns the error number in the current instance.set_errnoset the error number.
-
template<typename ReturnType, typename ...Args>
static void check(ReturnType r, Args&&... args) -
template<typename ReturnType, typename ...Args>
static void throw_(ReturnType r, Args&&... args) Convenient function for detect, report errors and throw exceptions.
check(r, ...args)tests ifr < 0. If so, callthrow_(r, args). Otherwise nothing happens.throw_(r, ...args)printing some informationargsand always throws anErrH5(). The printing can be turned on/off by setting the controlling flag to 1/0.
-
static flag_t err_cntl_flag() noexcept
-
static void err_cntl_flag(flag_t flag) noexcept
The error-reporing controlling flag of the HIPP HDF5 API. If set to 0, no error is printed on an exception. Otherwise some information is printed to
std::cerrbefore an thrown exception.err_cntl_flag()retrive the current flag,err_cntl_flag(flag)set the flag.The flag is thread-specific.
-
typedef herr_t errno_t