HighFive  2.2.2
HighFive - Header-only C++ HDF5 interface
H5Exception.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
3  *
4  * Distributed under the Boost Software License, Version 1.0.
5  * (See accompanying file LICENSE_1_0.txt or copy at
6  * http://www.boost.org/LICENSE_1_0.txt)
7  *
8  */
9 #ifndef H5EXCEPTION_HPP
10 #define H5EXCEPTION_HPP
11 
12 #include <memory>
13 #include <stdexcept>
14 #include <string>
15 
16 #include <H5Ipublic.h>
17 
18 namespace HighFive {
19 
24 class Exception : public std::exception {
25  public:
26  Exception(const std::string& err_msg)
27  : _errmsg(err_msg), _next(), _err_major(0), _err_minor(0) {}
28 
29  virtual ~Exception() throw() {}
30 
35  inline const char* what() const throw() override { return _errmsg.c_str(); }
36 
41  inline virtual void setErrorMsg(const std::string& errmsg) {
42  _errmsg = errmsg;
43  }
44 
50  inline Exception* nextException() const { return _next.get(); }
51 
56  inline hid_t getErrMajor() const { return _err_major; }
57 
62  inline hid_t getErrMinor() const { return _err_minor; }
63 
64  protected:
65  std::string _errmsg;
66  std::shared_ptr<Exception> _next;
68 
69  friend struct HDF5ErrMapper;
70 };
71 
75 class ObjectException : public Exception {
76  public:
77  ObjectException(const std::string& err_msg) : Exception(err_msg) {}
78 };
79 
83 class DataTypeException : public Exception {
84  public:
85  DataTypeException(const std::string& err_msg) : Exception(err_msg) {}
86 };
87 
91 class FileException : public Exception {
92  public:
93  FileException(const std::string& err_msg) : Exception(err_msg) {}
94 };
95 
99 class DataSpaceException : public Exception {
100  public:
101  DataSpaceException(const std::string& err_msg) : Exception(err_msg) {}
102 };
103 
108  public:
109  AttributeException(const std::string& err_msg) : Exception(err_msg) {}
110 };
111 
115 class DataSetException : public Exception {
116  public:
117  DataSetException(const std::string& err_msg) : Exception(err_msg) {}
118 };
119 
123 class GroupException : public Exception {
124  public:
125  GroupException(const std::string& err_msg) : Exception(err_msg) {}
126 };
127 
131 class PropertyException : public Exception {
132  public:
133  PropertyException(const std::string& err_msg) : Exception(err_msg) {}
134 };
135 
140  public:
141  ReferenceException(const std::string& err_msg) : Exception(err_msg) {}
142 };
143 }
144 
145 #include "bits/H5Exception_misc.hpp"
146 
147 #endif // H5EXCEPTION_HPP
Exception specific to HighFive Attribute interface.
Definition: H5Exception.hpp:107
AttributeException(const std::string &err_msg)
Definition: H5Exception.hpp:109
Exception specific to HighFive DataSet interface.
Definition: H5Exception.hpp:115
DataSetException(const std::string &err_msg)
Definition: H5Exception.hpp:117
Exception specific to HighFive DataSpace interface.
Definition: H5Exception.hpp:99
DataSpaceException(const std::string &err_msg)
Definition: H5Exception.hpp:101
Exception specific to HighFive DataType interface.
Definition: H5Exception.hpp:83
DataTypeException(const std::string &err_msg)
Definition: H5Exception.hpp:85
Basic HighFive Exception class.
Definition: H5Exception.hpp:24
std::shared_ptr< Exception > _next
Definition: H5Exception.hpp:66
virtual ~Exception()
Definition: H5Exception.hpp:29
virtual void setErrorMsg(const std::string &errmsg)
define the error message
Definition: H5Exception.hpp:41
hid_t _err_major
Definition: H5Exception.hpp:67
const char * what() const override
get the current exception error message
Definition: H5Exception.hpp:35
hid_t getErrMajor() const
HDF5 library error mapper.
Definition: H5Exception.hpp:56
std::string _errmsg
Definition: H5Exception.hpp:65
Exception * nextException() const
nextException
Definition: H5Exception.hpp:50
hid_t getErrMinor() const
HDF5 library error mapper.
Definition: H5Exception.hpp:62
hid_t _err_minor
Definition: H5Exception.hpp:67
Exception(const std::string &err_msg)
Definition: H5Exception.hpp:26
Exception specific to HighFive File interface.
Definition: H5Exception.hpp:91
FileException(const std::string &err_msg)
Definition: H5Exception.hpp:93
Exception specific to HighFive Group interface.
Definition: H5Exception.hpp:123
GroupException(const std::string &err_msg)
Definition: H5Exception.hpp:125
Exception specific to HighFive Object interface.
Definition: H5Exception.hpp:75
ObjectException(const std::string &err_msg)
Definition: H5Exception.hpp:77
Exception specific to HighFive Property interface.
Definition: H5Exception.hpp:131
PropertyException(const std::string &err_msg)
Definition: H5Exception.hpp:133
Exception specific to HighFive Reference interface.
Definition: H5Exception.hpp:139
ReferenceException(const std::string &err_msg)
Definition: H5Exception.hpp:141
Definition: H5_definitions.hpp:15
Definition: H5Exception_misc.hpp:19