Custom exception class for library errors
| 256 | |
| 257 | // Custom exception class for library errors |
| 258 | class TemplateException : public std::exception |
| 259 | { |
| 260 | uint32_t m_line; |
| 261 | std::string m_reason; |
| 262 | |
| 263 | public: |
| 264 | TemplateException(std::string reason) |
| 265 | : std::exception() |
| 266 | , m_line(0) |
| 267 | , m_reason(reason) |
| 268 | { |
| 269 | } |
| 270 | TemplateException(size_t line, std::string reason); |
| 271 | TemplateException(const TemplateException &other) = default; |
| 272 | TemplateException &operator=(const TemplateException &other) = default; |
| 273 | virtual ~TemplateException() = default; |
| 274 | |
| 275 | void set_reason(std::string reason) { m_reason = reason; } |
| 276 | void set_line_if_missing(size_t line); |
| 277 | |
| 278 | virtual const char *what() const NOEXCEPT NOTHROW { return m_reason.c_str(); } |
| 279 | }; |
| 280 | |
| 281 | // convenience functions for making data objects |
| 282 | inline data_ptr make_data(bool val) |
no outgoing calls
no test coverage detected