12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #ifndef HDF4CPP_HDFEXCEPTION_H
- #define HDF4CPP_HDFEXCEPTION_H
- #include <hdf4cpp/HdfDefines.h>
- namespace hdf4cpp {
- class HdfException : public std::exception {
- public:
- HdfException(const Type &type, const ClassType &classType, const std::string &message)
- : type(type)
- , classType(classType)
- , exceptionType(OTHER)
- , message(exceptionMessagePrefix + message) {
- }
- HdfException(const Type &type, const ClassType &classType, const ExceptionType &exceptionType)
- : type(type)
- , classType(classType)
- , exceptionType(exceptionType)
- , message(exceptionMessagePrefix + exceptionTypeMap.at(exceptionType)) {
- }
-
- Type getType() const noexcept;
-
- ClassType getClassType() const noexcept;
-
- ExceptionType getExceptionType() const noexcept;
-
- std::string getMessage() const noexcept;
-
-
- const char *what() const noexcept {
- return message.data();
- }
- private:
-
- static const std::string exceptionMessagePrefix;
-
-
- static const std::map<ExceptionType, std::string> exceptionTypeMap;
- Type type;
- ClassType classType;
- ExceptionType exceptionType;
- std::string message;
- };
- }
- #endif
|