-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception.hpp
More file actions
38 lines (31 loc) · 863 Bytes
/
exception.hpp
File metadata and controls
38 lines (31 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef PJRT_EXCEPTION_HPP_
#define PJRT_EXCEPTION_HPP_
#include <exception>
#include <string>
namespace pjrt {
/**
* @class Exception
* @brief Base class for all exceptions thrown by pjrt.
*
* This allows users to catch all library-specific exceptions
* with a single catch block.
*/
class Exception : public std::exception {
public:
/**
* @brief Constructs the exception with an explanatory string.
* @param message The message to be returned by what().
*/
explicit Exception(std::string message);
/**
* @brief Returns the explanatory string.
*
* This function is marked noexcept as it's an override from std::exception.
* @return A null-terminated string with the exception's message.
*/
const char* what() const noexcept override;
protected:
std::string msg_;
};
} // namespace pjrt
#endif // PJRT_EXCEPTION_HPP_