Namespace hdf5::error
¶
Classes¶
Singleton
¶
-
class hdf5::error::Singleton¶
singleton class for HDF5 error handling
This class facilitates handling of errors originating in the underlying C-API and HDF5 library. Singleton pattern assures a unique point of access to HDF5’s active error stack.
Public Functions
-
void auto_print(bool enable)¶
toggle automatic printing of error stack
By default, HDF5 prints the error stack to sterr upon the occurrence of every error. Turning this off redirects the stack to be passed out to the client using nested exceptions.
- Parameters
enable – set to true if autoprinting should be enabled, false otherwise
-
bool auto_print() const¶
indicates if automatic printing of error stack is on
-
H5CError extract_stack()¶
returns most recent error stack as Stack
Only works if auto_print is disabled. Returns a Stack (derived exception) as extracted from the HDF5 error stack of the most recent error condition(s).
After the stack is extracted it will removed from the error system.
-
void throw_with_stack(const std::string &message)¶
throws an exception, potentially nested with error stack
If auto_print is enabled, throws std::runtime_error. If auto_print is disabled, it also extracts the error stack and throws a nested exception, with the Stack object one level deeper. This function is to be used by most other functions implementing this HDF5 wrapper.
- Parameters
message – a user-supplied message for the exception
-
void clear_stack()¶
clears HDF5 error stack
-
void auto_print(bool enable)¶
H5CError
¶
-
class hdf5::error::H5CError : public runtime_error¶
runtime exception containing an HDF5 error H5CError
This is an exception class specifically for passing on an HDF5 error H5CError. The error H5CError is accessible as a standard list of Descriptor objects. Upon construction, the object also generates a string containing the a printout of the H5CError.
Public Functions
-
inline H5CError(const std::list<Descriptor> &H5CError)¶
constructor
Constructs a runtime exception object containing an HDF5 error H5CError. Should only be used internally by the library.
- Parameters
H5CError – a linked list of HDF5 error descriptors
-
inline const char *what() const noexcept override¶
printout of error H5CError
Returns the pre-generated string containing a printout of the error H5CError.
-
inline const std::list<Descriptor> &contents() const¶
access to error H5CError
Returns reference to list of error descriptors.
-
inline bool empty() const¶
what it says
Convenience function
-
inline H5CError(const std::list<Descriptor> &H5CError)¶
Descriptor
¶
-
struct hdf5::error::Descriptor¶
HDF5 error descriptor.
This is a descriptor for an error from the HDF5 error stack. It contains information about where in the underlying HDF5 library an error occurred. Such information may be passed on to the user of the library along with thrown exceptions, but only in the case that automatic error stack printing is turned off.
Public Functions
-
Descriptor(const H5E_error2_t &descr)¶
constructor
Constructs a mostly human-readable descriptor from the underlying C-API handle. Only used by the library internally.
- Parameters
descr – reference to C-API error entry
-
Descriptor(const H5E_error2_t &descr)¶
-
std::ostream &hdf5::error::operator<<(std::ostream &stream, const Descriptor &desc)¶
output operator for Descriptor
Functions¶
print_nested()
¶
-
std::string hdf5::error::print_nested(const std::exception &exception, size_t level = 0)¶
indented output of nested exceptions and included error stack
This recursive function is provided for formatted output of nested exceptions and, if included, the extracted error stack. For each level of nesting and for each level of the error stack, the output is on a new line and incrementally indented.
- Parameters
exception – the exception to print
level – indentation level